Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contorl for returnGeometry to dynamicMapLayer.bindPopup to reduce (unnecessary) load #919

Closed
kunKun-tx opened this issue Jan 31, 2017 · 3 comments · Fixed by #921
Closed

Comments

@kunKun-tx
Copy link

kunKun-tx commented Jan 31, 2017

  • Browser and version:

Chrome 55, IE11

  • Version of Leaflet (L.version):

1.0.3

  • Version of esri Leaflet (L.esri.VERSION):

2.0.7

Steps to reproduce the error:

  1. layer published with large and complicated features from ArcGIS server
  2. add layer as DynamicMapLayer in leaflet
  3. add bindPopup to layer and return feature's label featureCollection.features[0].properties.Label abc as popup content
  4. click feature

What happens is [long response time caused by GET-ing entire GeoJson object from server].

I was expecting [to get feature's properties alone without getting the whole geometry set. User should at least be able to choose if they want to get geometry. By choosing to load the layer as dynamicMapLayer, some (at least me) were avoiding prolonged loading time & complex svg's building time].

( jsbin that demonstrates the problem, click on the polygon near City of Houston and you will recreate the freeze)

  • Optional: I'm not using the CDN, I'm loading/bundling the library using: webpack but the jsbin example was set up using CDN.
@kunKun-tx
Copy link
Author

kunKun-tx commented Jan 31, 2017

I notice we can change returnGeometry in L.esri.query as part of ESRI REST API. Is there any way we can override this in bindpopup w/o extend-ing it or change the source code?

@kunKun-tx kunKun-tx changed the title Long response time when using bindPopup on complicated feature. Add contorl for returnGeometry to dynamicMapLayer.bindPopup to reduce (unnecessary) load Jan 31, 2017
@jgravois
Copy link
Contributor

jgravois commented Jan 31, 2017

thanks for the report! we're actually already discussing this in #633, so i'm going to go ahead and close this ticket and continue tracking there.

until we settle on a way to expose more fine grained control via bindPopup, you should consider calling identifyFeatures.run() instead.

map.on('click', function (evt) {
  districtMap.identify()
    .on(map)
    .at(evt.latlng)
    .returnGeometry(false)
    .run(function(error, featureCollection, response){
      console.log("abc");
    });
})

http://jsbin.com/coyejoy/edit?html,js,output

@jgravois jgravois reopened this Jan 31, 2017
@jgravois
Copy link
Contributor

its obviously not the same as skipping returning geometry entirely, but it would also be worth investigating applying a scale appropriate maxAllowableOffset to the identify request fired by bindPopup() automatically to help in edge cases where the original geometry is extremely vertex dense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants