Convert ESRI Shapefile (.shp) to geoJSON (.json)


Conversion result implemented in Google Maps, using data of my hometown Deinze, Belgium

To convert ESRI shapefiles to geoJSON (which you can perfectly use JavaScript and thus pass on to Google Maps, see screenshot above) you will need GDAL (Geospatial Data Abstraction Library) — Mac Users: download here. I have installed GDAL 1.9 Complete but perhaps the framework itself might also do.

After installation, you can use ogr2ogr to do the actual conversion.

Convert ESRI Shapefile to geoJSON:

/Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f "GeoJSON" output.json input.shp

Convert ESRI Shapefile to geoJSON with Coordinates Conversion (here LAMBERT 1972 (EPSG:31370) to WGS84):

/Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f "GeoJSON" -s_srs "EPSG:31370" -t_srs "WGS84" output.json input.shp

The latter is the command you’ll be looking for when working with gisoost.be buurtwegen data.

Did this help you out? Like what you see?
Thank me with a coffee.

I don\'t do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

BuymeaCoffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Join the Conversation

1 Comment

  1. Nice work, great description – saved me a year of converting this in ignorance of the easy way.

    Keep up the good work!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.