Why convert SHP to GEOJSON?
.geojson is the standard input format for web mapping libraries such as Leaflet, Mapbox, and OpenLayers, and it works directly in APIs and scripts. Unlike a Shapefile, GeoJSON is a single human-readable file that does not require GIS software to inspect, making it the natural choice for web development and data sharing.
How to convert SHP to GEOJSON
QGIS OPEN-SOURCE
Add the .shp via Layer > Add Layer, right-click the layer, choose Export > Save Features As, set format to GeoJSON, and set CRS to EPSG:4326.
ogr2ogr OPEN-SOURCE
Run ogr2ogr -f GeoJSON -t_srs EPSG:4326 out.geojson in.shp in a terminal; ogr2ogr ships with QGIS on Windows.
About these formats
A .shp file is almost always an Esri Shapefile - geospatial vector data (points, lines, polygons) used by GIS software. It is one piece of a set: it needs its sibling files (.shx, .dbf, and…
Open .SHP details →A GEOJSON file stores geographic features - points, lines, and polygons with their attributes - as plain JSON text, and it is the standard format for web mapping. To view it on a map…
Open .GEOJSON details →Quality & what to watch
- The GeoJSON spec requires WGS 84 (EPSG:4326); if the Shapefile uses a projected CRS and you skip reprojection, features will be misplaced on web maps.
- Attributes from the
.dbfbecome thepropertiesobject on each GeoJSON feature - field names, values, and types all carry over. - Shapefile
.dbffield names are limited to 10 characters; GeoJSON has no such limit, but any names already truncated in the original will remain truncated after conversion.
Frequently asked questions
Do I need all Shapefile component files?
.shp without its .shx and .dbf companions will fail to convert or produce GeoJSON with no attributes.