OK, I see. Well it appears that SimpleFeature#getID should return a unique ID, and the GeoJSON spec[1] doesn’t seem very clear on whether the “id” attribute need be unique or not, so I can see the conflict here. Still, I think the expected behavior would be to make use of the “id” attribute, if present. But I do not feel very strongly about this and in my case I can just use a custom property instead so if you are hesitant I will just let go of this.
-Tobias [1]: https://geojson.org/geojson-spec.html#feature-objects Från: Ian Turton <ijtur...@gmail.com> Skickat: den 12 maj 2022 19:46 Till: Tobias Gerdin <tobias.ger...@havochvatten.se> Kopia: Geotools-Devel list <geotools-devel@lists.sourceforge.net> Ämne: Re: [Geotools-devel] gt-geojsondatastore GeoJSONReader parseFeature does not report actual feature ids? On Thu, 12 May 2022, 17:36 Tobias Gerdin, <tobias.ger...@havochvatten.se<mailto:tobias.ger...@havochvatten.se>> wrote: Right, I’ll see if I can come up with that (don’t have a dev environment for GeoTools set up yet) I also noticed that feature ids do not seem to be returned correctly, i.e. mySimpleFeature.getID() always returns “feature.<index in collection>”, even though the GeoJSON feature object contains an “id” property. I assume this is not by design? No, that is by design. There is no guarantee that there will be an I'd attribute for each feature in the schemaless json without reading the whole file twice. Again if you'd like to add code to take an attribute and use that as the ID then I'm happy to review it. Ian Havs- och vattenmyndigheten behandlar dina personuppgifter i enlighet med dataskyddsförordningen och myndighetens dataskyddspolicy, läs mer på www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter<https://www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter> SwAM processes your personal data in accordance with the General Data Protection Regulation (GDPR) and our Data Protection Policy, see www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter<https://www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter>
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel