2

I'm trying to convert a simple shapefile drawn in GIS to GeoJSON. However, it's not working and I don't know why.

enter image description here

The file converts with QGIS (Save As), but the http://geojsonlint.com/ doesn't plot the shape, nor does my Mapbox application - it plots it as a line.

I've set the CRS to EPSG 3857.

Here's the GeoJSON, http://pastebin.com/93e0wWzA

Do you need the Shapefile to figure this out?

3
  • Perhaps it is because of EPSG:3857. Geojson is going to drop out CRS and use only CRS84 coordinates tools.ietf.org/html/draft-butler-geojson-04
    – user30184
    Oct 16, 2014 at 11:17
  • I changed the Shapefile to CRS84 and converted and still have the same issue
    – SMacFadyen
    Oct 16, 2014 at 11:26
  • could you also past the new GeoJSON? Oct 16, 2014 at 11:30

1 Answer 1

1

Geojsonlint seems to suppose that GeoJSON is in WGS84 coordinate system which is also the only officially supported CRS in the newest GeoJSON specification (draft) https://datatracker.ietf.org/doc/html/draft-butler-geojson-04

I converted your GeoJSON into epsg:4326 with ogr2ogr by using command

ogr2ogr -f geojson -s_srs epsg:3857 -t_srs epsg:4326 geojsontest2.json geojsontest.json

The new GeoJSON file does show in geojsonlint.

enter image description here

9
  • Hello - Can you share your ogr2ogr process? Thank you
    – SMacFadyen
    Oct 16, 2014 at 11:55
  • I edited my answer.
    – user30184
    Oct 16, 2014 at 12:09
  • Thanks. Could there be a possibility that the coordinates would be represented in a different location - the Polygon isn't supposed to be there. Is that related to changing the CRS?
    – SMacFadyen
    Oct 16, 2014 at 12:21
  • I don't understand. Do you mean that something has gone wrong with the first step when you converted your "simple shapefile drawn in GIS" into geojson? Nobody can say anything about that without making a test with the original shapefile.
    – user30184
    Oct 16, 2014 at 12:32
  • 1
    The polygon sits exactly at the same place when I convert your shapefile into geojson and tell that source is using epsg:3857. Show next a screen capture about where it should be. Think also carefully to which coordinate system you have digitized and saved it and if it really was epsg:3857. Your shapefile does not contain .prj file to tell it. Guessing the coordinate system is not my favorite play.
    – user30184
    Oct 16, 2014 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.