Opened 4 years ago
Closed 3 years ago
#4799 closed enhancement (fixed)
ST_AsGeoJSON doesn't export the CRS of multiple geometry columns
Reported by: | tobwen | Owned by: | pramsey |
---|---|---|---|
Priority: | low | Milestone: | PostGIS 3.2.0 |
Component: | postgis | Version: | master |
Keywords: | geojson, json, jsonb | Cc: |
Description
summary
ST_AsGeoJSON only uses the first geometry column to create the feature's geometry. The other geometry columns get stored in properties. But here, the CRS is missing. It's not in GeoJSON specs, but it might be useful to reconstruct the geometry.
example
SELECT ST_AsGeoJSON(data.*) FROM (SELECT 1 AS id, ST_Transform(geom, 3035) geom, ST_Transform(geom, 25832) geom FROM ST_SetSRID(ST_MakePoint(7, 51), 4326) geom ) data;
result
{ "type":"Feature", "geometry":{ "type":"Point", "crs":{ "type":"name", "properties":{ "name":"EPSG:3035" } }, "coordinates":[ 4110471.051819585, 3103060.820290524 ] }, "properties":{ "id":1, "geom":{ "type":"Point", "coordinates":[ 359666.70366028673, 5651728.682548149 ] } } }
nice to have
{ "type":"Feature", "geometry":{ "type":"Point", "crs":{ "type":"name", "properties":{ "name":"EPSG:3035" } }, "coordinates":[ 4110471.051819585, 3103060.820290524 ] }, "properties":{ "id":1, "geom":{ "crs":{ "type":"name", "properties":{ "name":"EPSG:25832" } }, "type":"Point", "coordinates":[ 359666.70366028673, 5651728.682548149 ] } } }
Change History (2)
comment:1 by , 4 years ago
Milestone: | PostGIS 3.1.0 → PostGIS 3.2.0 |
---|---|
Priority: | medium → low |
comment:2 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
In a9382ae/git: