Opened 14 months ago
Closed 11 months ago
#5597 closed defect (fixed)
ST_AsGeoJSONRow: Invalid output for null geometry
Reported by: | jtojnar | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.5.0 |
Component: | postgis | Version: | 3.4.x |
Keywords: | json | Cc: |
Description
According to the GeoJSON RFC, the `type` member of Geometry must be one of seven geometry type names. This is not the case when a row containing a NULL geometry column is converted to GeoJSON Feature:
postgres=# select ST_AsGeoJSON(r.*) from (values (null::geometry)) as r(geom); st_asgeojson ------------------------------------------------------------------- {"type": "Feature", "geometry": {"type": null}, "properties": {}} (1 row)
The proper representation is "geometry": null
, see section 3.2.
This can be trivially fixed but I am not sure whether it would be an acceptable BC break.
Change History (3)
comment:1 by , 14 months ago
Milestone: | PostGIS 3.4.1 → PostGIS 3.5.0 |
---|
comment:2 by , 13 months ago
jtojnar if you want to provide a patch for this, I think it's fine to go into 3.5.0. 3.4 or lower we'd have to seriously think about it. I doubt anyone is relying on the old representation of null geometries in older versions but who knows.
Probably safer to just put in 3.5.0 where we allow breaking changes, just in case someone is actually relying on this non-standard behavior.