Skip to main content

Spatial data

Shapefile vs GeoJSON: Which Format for Spatial Data?

Shapefile and GeoJSON are the two formats you meet first when you work with vector spatial data. They store the same kinds of thing, points, lines, and polygons with attributes, but in very different ways, and each has quirks worth knowing before you build a map or a pipeline. This guide compares them plainly and shows how to open either one in the browser with Groundtruth.

8 min read · Updated August 24, 2026

What each format actually is

A shapefile is an old Esri format that, despite the singular name, is a set of files that must travel together. The geometry lives in a .shp file, the attribute table in a .dbf file (a dBASE table), the coordinate system in a .prj file, and an index in a .shx file. A .cpg file may record the text encoding. Because it is several files, a shapefile is almost always shared zipped.

GeoJSON is a single text file in JSON, defined by an open standard (RFC 7946). One file holds the geometry and the attributes together as human-readable text. By specification, GeoJSON coordinates are longitude and latitude on the WGS84 datum, which removes a whole class of coordinate-system confusion.

Side by side

  • Files: shapefile is many files (.shp, .dbf, .prj, .shx, and more) zipped together; GeoJSON is one .geojson file.
  • Readability: GeoJSON is plain text you can open and diff; a shapefile is binary.
  • Coordinate system: a shapefile can be in any projection and carries it in the .prj; GeoJSON is longitude and latitude by the standard.
  • Attribute names: the shapefile's .dbf caps field names at 10 characters and has old type limits; GeoJSON property names are unrestricted.
  • Size: shapefiles are compact for large datasets; GeoJSON is larger as text but compresses well and streams easily on the web.
  • Ecosystem: shapefile is the lingua franca of desktop GIS and government data; GeoJSON is native to web maps and modern tooling.
The 10-character trap

The shapefile .dbf truncates attribute field names to 10 characters. A column called PopulationDensity2020 can arrive as PopulationD. If a join or a chart suddenly cannot find a field, a truncated shapefile name is a prime suspect. GeoJSON does not have this limit.

Coordinate systems, briefly

This is where the two formats differ most in practice. A shapefile might be in longitude and latitude, or in a projected system measured in metres such as UTM or a national grid. That matters because area and distance are only meaningful once you know the units. GeoJSON sidesteps the question by fixing longitude and latitude, but then any real area or distance has to be computed geodesically rather than from the raw coordinates.

A good tool reads the .prj to tell projected data from geographic, and computes real area and distance accordingly, in square kilometres and kilometres rather than raw coordinate units. If you are choosing a classification and reading areas off the result, make sure the numbers are real. See how to make a choropleth map for the full workflow.

Which should you use?

  • Use GeoJSON for web maps, for sharing a single readable file, for modern data pipelines, and when longitude and latitude is what you have.
  • Use shapefile when you exchange data with desktop GIS or government portals, when the dataset is large, or when a projected national coordinate system must be preserved exactly.
  • In many projects you will convert between them. Keep the .prj when you export a shapefile so the coordinate system is not lost.

How to open either one

You do not need desktop software to look at either format. Groundtruth opens both in the browser: drag a zipped shapefile (with its .dbf, .prj, and .cpg) or a .geojson onto the map and it parses the file locally, reads the attributes, detects the coordinate system, and lets you map, measure, join a spreadsheet, and export. Nothing is uploaded, so sensitive boundaries stay private.

Frequently asked questions

What is the difference between a shapefile and GeoJSON?
A shapefile is a set of binary files (.shp for geometry, .dbf for attributes, .prj for the coordinate system) usually zipped together, and can be in any projection. GeoJSON is a single human-readable text file in longitude and latitude by the standard. Shapefile dominates desktop GIS; GeoJSON is native to the web.
How do I open a shapefile without GIS software?
Use a browser tool that parses shapefiles locally. In Groundtruth you drag the zipped shapefile onto the map and it reads the geometry, attribute table, and coordinate system without any install.
Why are my shapefile field names cut off?
The shapefile .dbf format truncates attribute field names to 10 characters, so PopulationDensity becomes PopulationD. GeoJSON does not have this limit, which is one reason to convert long-named datasets.
Is GeoJSON always in latitude and longitude?
By the RFC 7946 standard, yes: GeoJSON coordinates are longitude and latitude on WGS84. Older files occasionally break this rule, but standards-compliant GeoJSON is always geographic.
Should I use shapefile or GeoJSON?
GeoJSON for web maps, single-file sharing, and modern tooling; shapefile for desktop GIS exchange, government data, large datasets, and preserving a projected national coordinate system. Keep the .prj when exporting a shapefile.

Bring this into your own research

Research Woven connects your sources, highlights, notes, evidence, and manuscript in one maintained chain, so provenance and citations are computed for you rather than pieced together by hand.

Open Research Woven

Keep reading