I try to identify features only from the wastepit layer. In this example I am adding two layers: wells and wastepit. I am only calling the identify function on the wastepit layer but I still get features if I press on a location for a well? Please see the codepen for live example. How can I do so I am only get the featureInfo from the wastepit layer? I dont understand why I in fact get feature from all (8) layers in the MapService?

    wells = L.esri.dynamicMapLayer({
            url: url,
            layers: [0]

pipe = L.esri.dynamicMapLayer({
                url: url,
                layers: [4]

wastepit = L.esri.dynamicMapLayer({
            url: url,
            layers: [5]

function getFeatureInfo(e) {
    .run(function(error, featureCollection){


  • 1
    Codepen example differs a great deal from the code above and your question. It's hard to quess then what you want to achieve.
    – TomazicM
    Feb 9, 2019 at 18:40
  • I am sorry about that, I was too slow to edit my question as I eventually found what the error was. The codepen now show a working example of what I tried to achieve to start
    – geogrow
    Feb 9, 2019 at 22:44

1 Answer 1


By default L.esri.IdentifyFeatures queries all the layers in the map service.


From the looks of your codepen, it appears you already found out that you can customize this behavior by supplying an alternative strategy and any combination of layers you want.


It's worth noting that dynamicMapLayer.bindPopup() passes through options set on the layer automatically.

It's also worth noting that its sub-optimal to add multiple individual dynamicMapLayers to the same map for each individual layer when you can ask the service to draw as many (or few) as you want all at once.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.