#4995 closed defect (fixed)
ogr2ogr geojson does not include CRS
Reported by: | nelson | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.0 |
Component: | OGR_SF | Version: | 1.9.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
When creating geojson via "ogr2ogr -t_srs EPSG:xxxx -f geojson", ogr2ogr correctly reprojects the coordinates to the requested SRS but it does not include the SRS identifer in the output GeoJSON. With no CRS specified, the GeoJSON spec says the default is "the WGS84 datum, and with longitude and latitude units of decimal degrees" which may well be incorrect.
There's code inside ogr2ogr to emit the CRS identifier which was #ifdefed out in December 2011: http://trac.osgeo.org/gdal/changeset/23662
Discussion of the ogr2ogr behavior: http://gis.stackexchange.com/questions/46881/ogr2ogr-from-postgres-to-geojson-missing-crs-key
Reference on GeoJSON CRS naming http://www.geojson.org/geojson-spec.html#coordinate-reference-system-objects
Change History (5)
follow-up: 3 comment:1 by , 11 years ago
Milestone: | → 1.10.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:3 by , 9 years ago
Replying to rouault:
r25665 "GeoJSON: write crs object as a FeatureCollection attribute in generated GeoJSON files (#4995); on read, strip AXIS nodes"
I am not sure if it's related but if try eg.
ogr2ogr -f GeoJSON -t_srs +init=epsg:3857 -s_srs +init=epsg:5514 test.json /vsicurl/http://geo102.fsv.cvut.cz/~landa/tmp/cfm.shp
The output GeoJSON file doesn't contain any information about SRS... ?
follow-up: 5 comment:4 by , 9 years ago
comment:5 by , 9 years ago
Replying to rouault:
trunk r28491, branches/1.11 r28492 "GeoJSON writer: make string comparison for authority name case insensitive so as to recognize lowercase 'epsg' (#4995)"
As a workaround you can use -t_srs EPSG:3857
Note that the IETF version of GeoJSON will deprecate any use of CRS != longlat WGS84
Thanks for clarification.
r25665 "GeoJSON: write crs object as a FeatureCollection attribute in generated GeoJSON files (#4995); on read, strip AXIS nodes"