koop icon indicating copy to clipboard operation
koop copied to clipboard

How to map provided data properties to GeoServices feature.id

Open pn-im opened this issue 7 years ago • 3 comments

I'm trying to expose a GeoJSON FeatureCollection using the GeoServices output with Koop. The Model implementation sets an 'id' on the resulting feature using a property pulled from the source of the data, but when querying the FeatureServer the 'id' of each feature is not present in the results. I can't find any place inside FeatureServer's source where an 'id' field is actually written out during query results processing. Is this a missing feature? I'm trying to visualize the data using an L.esri.FeatureLayer on a Leaflet map and it apparently needs ids to be on each feature in order to track and maintain them.

pn-im avatar Jan 17 '18 21:01 pn-im

hello! i'm pretty sure i can reproduce the behavior you describe by setting isModern: true in my own constructor.

http://jsbin.com/jucepul/1/edit?html,output

are you seeing appropriate behavior in Esri Leaflet when you request f=json from the service instead of f=geojson?

jgravois avatar Jan 17 '18 22:01 jgravois

I can force GeoJSON with isModern:true but the underlying FeatureManager class inside esri-leaflet still uses feature.idto track features being added. I noticed in your example your features did not provide an "id" at the feature level, but still manage to all render inside the Leaflet map. Unsure why that is at this point. Further digging required.

If anyone can shed light on mapping the data provider's id to the outgoing GeoServices feature id, that would be most excellent.

pn-im avatar Jan 18 '18 14:01 pn-im

@pn-im you can set geojson.metadata.idField

dmfenton avatar Feb 07 '18 21:02 dmfenton