GeoJSONReader ignores feature "id" value.

Description

When reading GeoJSON from file, it appears the “id” value for a feature is ignored. The id is generated using the GeoJSONSource name and a one-up counter starting at zero e.g. “my-file.0”, “my-flle.1”, etc…

I noticed this behavior after upgrading from GeoTools 22.x to 27.0.

Environment

None

Activity

Ian Turton 
July 22, 2022 at 11:04 AM

Looking at the code, there is nothing special being done to the id field. Should be easy enough to use it instead of the sequential id in generating the fid if it’s present.

Andrea Aime 
July 19, 2022 at 2:49 PM

I agree the low level reader should preserve the original id. The datastore built on top of it should follow convention and have an id like “typename.nativeId” to allow WFS to work properly in GeoServer (GetFeature can be called by giving just the id, without the target feature type, and the server must be able to find it, hence the convention, it tries to make for unique names).

Fixed

Details

Assignee

Reporter

Affects versions

Priority

Created July 18, 2022 at 11:47 PM
Updated February 14, 2023 at 3:38 PM
Resolved February 14, 2023 at 3:38 PM