GeoJSON vs Shapefile — Which Is Better?

GeoJSON is a modern format for web GIS and APIs, while Shapefile is the classic desktop GIS standard. The choice depends on where you'll use the data.

Criteria GeoJSON Shapefile
Web compatibility✓✗
Desktop GIS✓✓
Single file✓✗
Big data performance✗✓
Human-readable✓✗

When to use GeoJSON

For web apps, APIs, Leaflet/Mapbox/OpenLayers, processing in Python/JS.

When to use Shapefile

For ArcGIS, QGIS, government systems, large datasets, legacy workflows.

What is GeoJSON?

Example OpenStreetMap map exported to GeoJSON
GeoJSON: an OpenStreetMap map exported by osm2cdr.

GeoJSON was designed in 2008 by a working group of developers and standardised by the IETF as RFC 7946 in 2016. It encodes geographic features in JavaScript Object Notation, which made it the default exchange format of web mapping and of most geospatial APIs.

A typical file is a FeatureCollection: an array of features, each with a geometry (Point, LineString, Polygon or their Multi variants) and a free-form properties object. Coordinates are decimal longitude and latitude. There are no styles, no spatial index and no fixed schema — every feature may carry different properties.

Software that opens GeoJSON

Leaflet, MapLibre GL, OpenLayers and D3.js load GeoJSON directly; QGIS, ArcGIS Pro, GDAL/ogr2ogr, GeoPandas and PostGIS import it, and GitHub previews GeoJSON files on a map.

Where GeoJSON is strong

It is readable by humans, parsed by every programming language and needs no companion files. Properties can hold any number of attributes with long names and Unicode values, which makes the format ideal for web APIs and small to medium datasets.

Limitations of GeoJSON

Text encoding makes files big and slow once they reach millions of features, there is no spatial index, and the single fixed coordinate system means projected data must be reprojected. Mixed geometry types in one file confuse desktop tools that expect one type per layer.

What osm2cdr puts into a GeoJSON file

osm2cdr writes one FeatureCollection holding every layer of the selected area. Each feature keeps its OpenStreetMap name, type and tags, plus a _layer property naming its source layer — roads, buildings, water, greenery or points of interest — so a single filter splits the data apart again.

What is Shapefile?

Example OpenStreetMap map exported to Shapefile
Shapefile: an OpenStreetMap map exported by osm2cdr.

The shapefile was introduced by Esri in the early 1990s with ArcView GIS, and Esri published its technical description in 1998. It is not a formal standard, yet three decades of use have made it the most widely accepted exchange format in desktop GIS.

A shapefile is a set of files sharing one base name: .shp holds the geometry, .shx an index into it, .dbf the attribute table in dBASE format, .prj the coordinate system and .cpg the text encoding. Each shapefile stores exactly one geometry type — points, lines or polygons.

Software that opens Shapefile

ArcGIS, QGIS, MapInfo, Global Mapper, GRASS GIS, GeoPandas, PostGIS (through shp2pgsql) and GDAL read and write shapefiles, and AutoCAD Map 3D and many surveying packages import them.

Where Shapefile is strong

Support is universal and fast, the structure is simple to implement, and public agencies and contractors routinely request it. The attribute table opens even in tools that know nothing about geometry but understand dBASE.

Limitations of Shapefile

Field names are capped at ten characters, text fields at 254 characters and each component file at 2 GB. One geometry type per file means a map becomes several shapefiles, and losing a companion file breaks the dataset.

What osm2cdr puts into a Shapefile file

osm2cdr delivers a ZIP in which every layer — roads, buildings, water, greenery, points of interest — sits in its own folder as a complete .shp, .shx, .dbf and .prj set, with a README describing the contents. OpenStreetMap attributes are written in UTF-8, and coordinates are WGS 84.

Key differences explained

At the most basic level, GeoJSON is a JSON-based open format for geographic features, while Shapefile is a multi-file vector format created by Esri. On disk, GeoJSON is plain UTF-8 JSON text; Shapefile is binary geometry files plus a dBASE attribute table.

Here is what the comparison table above means in practice, point by point:

Example OpenStreetMap map exported to GeoJSON-Seq
A related export: the same kind of map in GeoJSON-Seq, a format often used next to GeoJSON.

In short: choose GeoJSON when the data feeds a web map, an API or a script. Choose Shapefile when the data goes into a desktop GIS workflow or to an agency that asks for shapefiles.

GeoJSON or Shapefile: which one fits your job?

You are adding a layer of local cafés to a Leaflet or MapLibre web map. GeoJSON loads with one line of JavaScript, keeps every OpenStreetMap tag as a property and needs no unpacking, so it is the obvious choice.

A municipal GIS department asks for road and building data for a planning study and says it works in ArcGIS with shapefiles. Sending a shapefile set per layer saves them a conversion step and matches their delivery checklist.

You are cleaning OSM data in Python with GeoPandas before analysis. Either format loads, but GeoJSON keeps long tag names intact, while a shapefile cuts field names to ten characters — which matters as soon as tags like building:levels or addr:housenumber become columns.

Pitfalls when switching between GeoJSON and Shapefile

When converting GeoJSON to a shapefile, long property names are truncated and may collide, mixed geometry types have to be split into separate files, and text longer than 254 characters is cut. Going from shapefile to GeoJSON, coordinates must end up in WGS 84 to meet RFC 7946, so projected data needs reprojection. Note also that osm2cdr's GeoJSON keeps every layer in one file with a _layer property, whereas its shapefile export already separates layers into folders.

For a quick visual check of either file, drag it into QGIS: both open without settings, and the OSM attributes appear in the attribute table.

Which to pick on osm2cdr

On osm2cdr, pick GeoJSON for web maps, APIs and scripts. Pick Shapefile when the recipient's workflow or contract explicitly requires it, or when older desktop GIS tools are involved. If you want a modern single-file alternative to both, GeoPackage is worth a look.

How to get GeoJSON or Shapefile from OpenStreetMap

osm2cdr builds GeoJSON and Shapefile directly from OpenStreetMap data — there is no need to download raw OSM extracts or install conversion tools. The steps:

  1. Open the osm2cdr map for GeoJSON and find your place by name, or draw a rectangle around the area.
  2. Choose GeoJSON or Shapefile in the format list and set the options offered for it, such as map layers, style or sheet size.
  3. Start the export and download the result: GeoJSON arrives as a .geojson file; Shapefile arrives as a ZIP with one folder of .shp, .shx, .dbf and .prj files per layer.
  4. Need Shapefile as well as GeoJSON? Run a second export of the same area. Both start from the same OpenStreetMap data, but each keeps only what its format can hold, as described in the sections on GeoJSON and Shapefile above.

Converter pages related to GeoJSON and Shapefile explain each route in more detail:

Frequently asked questions

What is the main difference between GeoJSON and Shapefile?

GeoJSON is a JSON-based open format for geographic features, whereas Shapefile is a multi-file vector format created by Esri. In the comparison table, GeoJSON is ahead on web compatibility, single file and human-readable; Shapefile is ahead on big data performance.

Which is better for web compatibility, GeoJSON or Shapefile?

GeoJSON. It is readable by humans, parsed by every programming language and needs no companion files.

When does Shapefile beat GeoJSON?

When big data performance matters most. Support is universal and fast, the structure is simple to implement, and public agencies and contractors routinely request it.

Can I convert GeoJSON to Shapefile?

Yes. osm2cdr has a dedicated GeoJSON to Shapefile converter page for existing files. If you are starting from OpenStreetMap, export the area straight to Shapefile instead.

Which programs open GeoJSON and Shapefile files?

GeoJSON files open in Leaflet, MapLibre GL, OpenLayers, QGIS, GDAL and GeoPandas. Shapefile files open in ArcGIS, QGIS, MapInfo, Global Mapper, GRASS GIS and PostGIS.

Do GeoJSON and Shapefile keep real-world coordinates?

GeoJSON is fixed by RFC 7946 to WGS 84 longitude and latitude, and osm2cdr follows the rule, so every feature is ready for web maps. Shapefile keeps its coordinate system in the .prj companion file; osm2cdr writes WGS 84 (EPSG:4326) with a matching .prj for every layer.

Export to GeoJSON Export to Shapefile