-
Notifications
You must be signed in to change notification settings - Fork 797
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
Should be able to pass identify options into bindPopup for a dynamic layer #633
Comments
we typically expect people to call the available methods for setting identify request properties in advance of calling L.esri.Tasks.identifyFeatures({
url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'
})
.on(map)
.at([45.543, -122.621])
.layers('visible:1')
.returnGeometry(false)
.tolerance(3)
.run(function(error, featureCollection, response){
console.log("UTC Offset: " + featureCollection.features[0].properties.ZONE);
}); is there a reason why this isn't ideal for you? |
I create the layer using |
thanks for clarifying.. i'll have to think about this a bit to try and decide the best way to expose an opportunity to get more fine grained control (ie: dynamicMapService initialization, when calling would it be sufficient to be able to pass identifyParameters that applied to all layers, or are you expecting to set things differently layer by layer? |
I hope layer by layer. Use case is time-based identify calls -- maybe you want to see data for a layer a year in the future of data for another layer. The single parameter set won't do there. But bigger picture, it would be useful to set a variety of parameters that are currently exposed via methods as parameters into the |
but for the time being you can just listen for the map click, fire your own identifyFeatures request and display the results in a popup, correct? |
Oh, for sure! This isn't blocking me, just a nice to have. I really like the bindPopup feature, just thought you guys might be interested in some feedback. |
always. thank you for it. 😄 |
Is there any more thought to adding the ability to set tolerance per dyn layer? I would actually take it on all dyn layers because on the phone people are having trouble hitting the features. |
its already possible to modify tolerance when identifying on all layers using the corresponding exposed method. var map = new L.Map('map').setView([ 45.543, -122.621 ], 5);
L.esri.identifyFeatures({
url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer'
})
.on(map)
// ...
.tolerance(5) // default value is 3 screen pixels
.run(function(error, featureCollection, response){
// ...
}); |
@jgravois, I wish to do the same thing (modify tolerance parameter), but didn't get how this:
is related to your example
Should I do that declaration for every specific layer I have? What about the |
@carrbrpoa check out #919 (comment) for more information about that. until we decide on a way to expose more configuration options when calling
you don't have to call it over and over because the operation is capable of returning results from multiple layers. var serviceUrl = 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer';
var id = L.esri.identifyFeatures({ url: serviceUrl })
.on(map)
.layers("all:0,1,2") // http://esri.github.io/esri-leaflet//api-reference/tasks/identify-features.html#methods
.tolerance(5)
map.on('click', function (evt) {
id.at(evt.latlng);
id.run(function(error, featureCollection, response){
console.log(featureCollection);
});
}); |
i had another look at this today and i think we'd get the most bang for our buck by giving developers an opportunity to supply their own custom IdentifyFeatures object when they instantiate their dynamicMapLayer var customBehavior = L.esri.identifyFeatures({ url: serviceUrl })
.layers("all:0,1,2")
.tolerance(5)
// etc.
var dynamicLayer = L.esri.dynamicMapLayer({
url: serviceUrl,
popup: customBehavior
}).addTo(map);
dynamicLayer.bindPopup(/* ... */) this would allow for more fine-grained control over the |
@Biboba very cool! please open up a PR so i can take a deeper look, hopefully later this week. |
in #1031 @Biboba implemented my pseudo-code in #633 (comment) in the actual library. thank you for another excellent contribution! 🎉 |
Right now there are defaults that are applied to the identify call from a dynamic layer. It would be great to be able to pass an options object that overwrote some of those. For example, I might not want to return the geometry for the feature, or, I might want to make the tolerance higher (or lower).
The text was updated successfully, but these errors were encountered: