I'm a newbie to the GIS world and I'm trying to convert a shapefile to GeoJSON for use in Mapbox.

When I view the resulting layer in Mapbox, most of the features appear southeast by 20-30 feet of where they should be to match up properly with the underlying Mapbox map. (View at http://blueroomdesign.net/stlv/)

How do I adjust the Mapshaper command to fix this offset issue?

Here's the command line I'm currently using to convert it:

mapshaper -i prcl.shp -proj latlon -o prcl_out.geojson precision=0.000001

Some of the information from running the Mapshaper Info command on the shp file (below) looks relevant but I'm not quite sure how to interpret it or correct for it in the conversion process.

Layer name: prcl
Records: 127,748
Type: polygon
Bounds: 551318.459568 982946.566771 592589.572865 1070913.306444
Proj.4: +proj=tmerc +x_0=152400.3048006096 +lon_0=-90.5 +k_0=0.9999333333333333 +lat_0=35.83333333333334 +to_meter=0.3048006096012192 +ellps=clrk66

Here's a link to the original shapefile zip: St Louis Parcel Data

  • possibly you can use the -affine command – nmtoken Jan 5 at 18:24

When I inspect that shapefile using ogrinfo I see that it's a state plane projection that uses a NAD27 datum:

$ ogrinfo -al -so /vsizip/prcl_shape.zip

INFO: Open of `/vsizip/prcl_shape.zip'
  using driver `ESRI Shapefile' successful.

Layer name: prcl
Geometry: Polygon
Feature Count: 127748
Extent: (551318.459568, 982946.566771) - (592589.293649, 1070913.306444)
Layer SRS WKT:
PROJCS["NAD27 / Missouri East",
            SPHEROID["Clarke 1866",6378206.4,294.9786982138982,
    UNIT["US survey foot",0.3048006096012192,
HANDLE: String (16.0)

It's likely you're experiencing problems with Mapshaper when projecting the data from the NAD27 to WGS84 datum as it's not accounting for the datum shift. This will cause your data to become misaligned when projected from the Missouri East state plane to WGS84.

I'm not able to find how to specify the input file's CRS in Mapshaper's documentation, but using ogr2ogr (another CLI tool for processing geospatial data), you can:

$ ogr2ogr -s_srs EPSG:26796 -t_srs EPSG:4326 -f GeoJSON prcl_shape_4326.geojson /vsizip/prcl_shape.zip

The resulting GeoJSON file is 49MB so I took a sample of it and uploaded it as a Github Gist which you may view here: https://gist.github.com/clhenrick/7f90a863d153f9ae2871012a1d624e0d

  • Very helpful. I'll poke around more in the Mapshaper documentation, because I'm also doing a data join with a csv file and I'm not sure how to do that in ogr2ogr. Thank you! – Dave M-engineer Jan 6 at 5:49
  • No problem, please vote the answer up if you found it helpful. You could project the parcel data using ogr2ogr then join the csv using mapshaper. – clhenrick Jan 6 at 17:06
  • Yes. Helpful. I gave it an up vote, but it doesn't display pubblicly because I don't have a high enough reputation yet. -- Before going to ogr2ogr, I need to experiment more with Mapshaper because I'm hoping to set this up as an automated process as the files are updated..(Although I'd guess the parcel polygons will be rarely updated.) This is something Mapshaper should be able to do, I just need to figure out the command syntax. – Dave M-engineer Jan 7 at 15:37
  • I heard back from Matt Bloch, the author of MapShaper. He said MapShaper doesn't support conversions from that CRS: "The coordinate system of your original file uses the NAD27 datum, which was developed in 1927 using traditional surveying techniques. Mapshaper doesn't support converting these coordinates to a modern coordinate system. (I'll look into adding a useful error message about this.)" – Dave M-engineer Jan 17 at 7:41
  • Good to know! Glad he will add an error message about it. – clhenrick Jan 21 at 0:51

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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