I am very new to Leaflet.
I am trying to set up a dynamicMapLayer to have a popup for every layer in the map service.
All of the examples that I have seen so far use canned examples with simple layer definitions. I am using a map service with more than two dozen layers, each of which has a distinct set of fields.
What I would like to do is make popup definitions that are distinct to each layer. Where I am getting stuck is that I do not know how to identify the layer names that are gathered into the featureCollection array.
This is the code that I am using below. It returns a popup when it identifies a feature with the Facility Identifier and LegacyID fields.
Ideally, I would have a method return the appropriate popup fields based on the layer name (i.e. Sewer Manholes, Streets, Sewer Cleanout, etc...).
Can anyone point me in the right direction? Thank you.