postpass icon indicating copy to clipboard operation
postpass copied to clipboard

Violation of the GeoJSON specification in the server response

Open Andygol opened this issue 8 months ago • 4 comments

These parts of the code violate the GeoJSON specification (see RFC7946 https://datatracker.ietf.org/doc/html/rfc7946#section-3.3) regarding the allowed content of the FeatureCollection Object

A FeatureCollection object has a member with the name "features".

https://github.com/woodpeck/postpass/blob/57756589aec38a94ffd7ff20aff4ca408f89696e/postpass/main.go#L98-L101

https://github.com/woodpeck/postpass/blob/57756589aec38a94ffd7ff20aff4ca408f89696e/postpass/main.go#L112-L115

Andygol avatar Apr 19 '25 14:04 Andygol

I am not super invested in having these two propterties items, I just thought it may be nice to have. Perhaps I should simply rename them extradata instead of properties and then they could sail under https://datatracker.ietf.org/doc/html/rfc7946#section-6.1:

Members not described in this specification ("foreign members") MAY be used in a GeoJSON document.

– would that be better?

woodpeck avatar Apr 21 '25 20:04 woodpeck

https://datatracker.ietf.org/doc/html/rfc7946#section-6.1:

It's up to you. However, according to the GeoJSON specification, extra properties are added to a particular "type": "Feature" element, which can lead to output clogging with repeated lines of information, which can cause additional traffic and processing costs.

If this is possible, I would simplify the output by removing this additional property altogether. GeoJSON is fine when you need to render data visualisations, but it's not so great for data exchange.

Andygol avatar Apr 22 '25 08:04 Andygol

I don't know of any actual issue with those additional fields. Its good to have them … but they do no harm – even if invalid from a schema point of view.

tordans avatar May 23 '25 12:05 tordans

I don't know of any actual issue with those additional fields.

You can try using the output with https://geojson.io/ to run into some issues. 🤷‍♂

IMO It is better to follow standards, especially when they are established.

Andygol avatar May 23 '25 15:05 Andygol