2

I am trying to convert SHP to GeoJSON to work with Google Maps API's data layers.

I am working with ogre (I also tried mapshaper, but it always give bad coordinates). When I convert SHP with WGS84 format, the conversion works fine. However when I try to convert MTM3 and UTM6 SHP formats to GeoJSON, the coordinates are all screwed up.

Bad coordinates example: {"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[642014.75,4911335.859999999],[642005.96,4911335.92],[642005.6600000001,4911380.0600000005],[642003.6200000001,4911405.58] ...

I notice that on the ogre website, there are optional fields for Source SRS & Target SRS. Am I suppose to add something there to get UTM/MTM conversions to work?

6
  • what commands are you using?
    – Mapperz
    Commented Apr 9, 2018 at 1:43
  • @Mapperz Commands? I'm just uploading the SHP zip file and converting it.
    – Jack
    Commented Apr 9, 2018 at 1:51
  • like skip failure?
    – Mapperz
    Commented Apr 9, 2018 at 2:03
  • @Mapperz I just tried both 'skip failure' and 'Create Mapbox-compatible file (RFC7946)', both returned the same bad coordinates
    – Jack
    Commented Apr 9, 2018 at 2:44
  • GeoJSON only supports one Coordinate reference system.
    – nmtoken
    Commented Apr 9, 2018 at 5:48

1 Answer 1

2

If your source data are using some other coordinate system than EPSG:4326 and you need to get GeoJSON according to current standard https://www.rfc-editor.org/rfc/rfc7946 you must give the EPSG codes for both the input and output data.

For MTM3 the code to use seems to be 32183 http://georepository.com/crs_32183/NAD83-MTM-zone-3.html and for UTM zone 6 it may be 32606 http://georepository.com/crs_32606/WGS-84-UTM-zone-6N.html. The output code is 4326. Alternatively check the "Create Mapbox-compatible file (RFC7946)" box which should change the output automatically into EPSG:4326.

As mentioned, the GeoJSON standard defines that coordinates are expressed as WGS84 long-lat coordinates but other coordinates systems can be used if needed:

However, where all involved parties have a prior arrangement, alternative coordinate reference systems can be used without risk of data being misinterpreted.

If support for other coordinate systems is needed it is common to follow the older GeoJSON specification http://geojson.org/geojson-spec.html.

Ogre is a simple web client for the GDAL utility program ogr2ogr http://www.gdal.org/ogr2ogr.html. If you want better control for the conversion I recommend to install GDAL on your own computer and run ogr2ogr locally. The detail of the GDAL GeoJSON driver are documented in http://www.gdal.org/drv_geojson.html.

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.