1

I have a dynamicMapLayer with a layer definition set to filter out certain features, the problem is that the popup which is bound to this layer does not recognize the layer definition and will display information for features not drawn on the map.

<script>
  var map = L.map('map').setView([38.95, -81.203], 8);
  L.esri.basemapLayer('Gray').addTo(map);
  var mines = L.esri.dynamicMapLayer({
url:'http://atlas.wvgs.wvnet.edu/arcgis/rest/services/Coal_Web_Mercator/All_Mining_WM/MapServer/',
    layers: [1],
    layerDefs: {1:"SEAM = 'Redstone'"},
    opacity: 0.5,
    useCors: false
  }).addTo(map);
  var popupTemplate = "<h3>{SEAM}</h3><br><small>Name: {MINE_NAME}<small>";
  mines.bindPopup(function (error, featureCollection) {
    if(error || featureCollection.features.length === 0) {
      return false;
    } else {
      return L.Util.template(popupTemplate, featureCollection.features[0].properties);
    }
  });
</script>

1 Answer 1

1

This appears to have been a bug and the problem has been resolved in pass through layer definitions when binding a popup.

0

Your Answer

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

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