I'm currently using an older (6months+) version of esri-leaflet and previous I modified the onEachFeature function to be able to find the related L.esri.featureLayer for the layer.
With this I could then access the field metadata through featureLayer.fields
The reason was for simple type detection and formatting for display in popup - i.e. detect the esriFieldTypeOID field and ignore it, or detect a date field and format the output accordingly etc.
I don't see an equivalent of the 'fields' array in the current FeatureLayer class - is there somewhere else I can get this metadata for a layer?
Yes each layer has a built in layer.metadata()
method to get the metadata for the layer. It accepts a callback function which will be executed with error
and metadata
which will contain your field information.
Getting service metadata | Esri Leaflet
In this example the metadata
in the callback function should contain all your field information.
That did it thanks- don't know how I missed that...very much appreciated!