api icon indicating copy to clipboard operation
api copied to clipboard

discuss: duplicate `id` property in geojson

Open missinglink opened this issue 6 years ago • 2 comments

we have a property called id in the geojson which appears to be a dupe of source_id

would it be possible to deprecate and remove one of these two properties?

Screenshot 2019-11-14 at 14 24 35

missinglink avatar Nov 14 '19 13:11 missinglink

Deprecating properties from the GeoJSON response that comes from Pelias would be hard and painful, I don't think we have a good process around it, and it might not be too valuable.

However we should definitely remove the underlying data duplication, which is tracked in https://github.com/pelias/schema/issues/383

orangejulius avatar Nov 26 '19 17:11 orangejulius

I was sitting with someone recently who was new to Pelias, they were using React, which requires a unique key to render a list of items (so it can correctly track state changes).

He naturally assumed that id was the correct field to use for this purpose but was later confused why fewer results were being rendered in React than were provided in the raw geojson response.

What was happening here was that the results contained both a venue and an address from the same OSM source ID and so keying the data using id was removing one of the two disparate records

I think you're right that completely removing the field could easily break integrations but it's still unintuitive as-is, maybe we can resolve this by having id as a duplicate of the gid field instead of the source_id field?

missinglink avatar Jul 14 '20 12:07 missinglink