Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CRS to geojson output #14

Closed
brunosan opened this issue Aug 21, 2014 · 5 comments
Closed

Add CRS to geojson output #14

brunosan opened this issue Aug 21, 2014 · 5 comments

Comments

@brunosan
Copy link

Add the CRS info to the geojson output.

Currently the workaround is this:

mercantile shapes - --x-json-seq  --mercator | \
sed -E 's/\}$/,"crs": \{"type": "EPSG","properties": \{"code": 3857 \}\}\}/g'

cc @hrwgc

@sgillies
Copy link
Contributor

Is there a need for CRS? According to the last paragraph under "DESCRIPTION" in http://www.gdal.org/gdalwarp.html a Mercator GeoJSON with no CRS should be fine when the warp destination is Mercator.

The GeoJSON authors are recommending against the old GeoJSON objects in the latest draft submitted to the IETF: http://tools.ietf.org/html/draft-butler-geojson-04. I'm uncomfortable with having mercantile write the old style CRS objects.

@hrwgc
Copy link

hrwgc commented Aug 21, 2014

@sgillies without CRS, gdalwarp assumes geojson cut line to be in WGS84, it appears from our testing yesterday.

Sent from my iPhone

On Aug 21, 2014, at 9:13 AM, Sean Gillies notifications@github.com wrote:

Is there a need for CRS? According to the last paragraph under "DESCRIPTION" in http://www.gdal.org/gdalwarp.html a Mercator GeoJSON with no CRS should be fine when the warp destination is Mercator.

The GeoJSON authors are recommending against the old GeoJSON objects in the latest draft submitted to the IETF: http://tools.ietf.org/html/draft-butler-geojson-04. I'm uncomfortable with having mercantile write the old style CRS objects.


Reply to this email directly or view it on GitHub.

@sgillies
Copy link
Contributor

Dammit, gdalwarp. I'm looking into it now. Meanwhile, here's the workaround using ogr2ogr to make an EPSG:3857 shapefile.

$ mercantile shapes "[106, 193, 9]" --mercator | ogr2ogr -f "ESRI Shapefile" -a_srs EPSG:3857 /tmp/mersh.shp /vsistdin/

I should update Fiona's fio script to allow the same kind of thing.

@sgillies
Copy link
Contributor

See #16 (comment). Right now the workaround is to pipe CRS-less GeoJSON through ogr2ogr using /vsistdin/ and /vsistdout/.

mercantile shapes "[72, 109, 8]" --mercator \
| ogr2ogr /vsistdout/ /vsistdin/ -f GeoJSON -a_srs EPSG:3857 \
| gdalwarp ~/code/rasterio/rasterio/tests/data/RGB.byte.tif /tmp/72_109_8.tif -crop_to_cutline -cutline /vsistdin/ -t_srs EPSG:3857

@sgillies
Copy link
Contributor

Fixed in Mercator 0.4 (coming soon). See #16 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants