CSV vs GeoJSON vs Shapefile: Which Format Should You Ask For?
Four formats, four sets of limitations. Choosing the wrong one loses data silently, which is the worst way to lose it.
- Author
- HuiTu Technology
- Published
When you commission a dataset, the format question usually gets answered in three seconds with whatever the requester's software opens by default. It deserves slightly more thought, because two of the common answers silently damage data.
| CSV | GeoJSON | Shapefile | GeoPackage | |
|---|---|---|---|---|
| Geometry support | Points only, as columns | All types | One type per file | All types |
| Field name length | Unlimited | Unlimited | 10 characters | Unlimited |
| Multiple layers | No | No | No | Yes |
| Coordinate system stored | No | Assumed EPSG:4326 | Yes, in .prj | Yes |
| Data types preserved | No | Partly | Partly | Yes |
| Files per dataset | 1 | 1 | 4 to 7 | 1 |
| Practical size ceiling | Large | ~100 MB in a browser | 2 GB hard limit | Very large |
CSV: fine for points, hopeless for anything else
CSV is the right delivery for a point dataset that will be opened in a spreadsheet or loaded into a database. It is universal, diffable and readable by everything. It stores no coordinate system, so anyone receiving it has to assume, and it cannot represent a line or a polygon without resorting to WKT strings in a column, which most spreadsheet users will then break.
GeoJSON: the web default
GeoJSON is plain text, human-readable, supported by every web mapping library and by all modern GIS software. It handles every geometry type and nested attributes. It is the natural answer for anything that will be displayed in a browser or consumed by an API.
Its weakness is size. Coordinates stored as text with excessive precision produce enormous files: the same layer that occupies 40 MB as GeoJSON might be 6 MB as a GeoPackage. Trimming coordinates to six decimal places, which is roughly 10 cm of precision, typically removes a third of the file with no meaningful loss.
# Trim coordinate precision and reproject in one pass
ogr2ogr -f GeoJSON out.geojson in.gpkg \
-t_srs EPSG:4326 \
-lco COORDINATE_PRECISION=6
# Anything over ~50 MB should become vector tiles instead
tippecanoe -o out.pmtiles -zg --drop-densest-as-needed out.geojsonShapefile: still everywhere, still from 1993
The shapefile is not one file but a set of them, and if the .prj or .dbf is missing in transit the data is degraded or unusable. Its two genuinely damaging limitations are worth stating plainly.
- Field names are truncated to 10 characters. 'population_density' becomes 'population', and if you also have 'population_total' you now have 'populati_1'. Meaning is destroyed silently.
- There is a 2 GB size limit per file, which large modern layers exceed routinely.
- Character encoding is not reliably declared, so non-ASCII names arrive corrupted often enough to plan around.
- Only one geometry type per file, so a mixed layer has to be split.
Ask for shapefiles when your recipient's workflow genuinely requires them, which is still common in engineering and planning environments. When you do, ask for a field-name mapping table alongside, so the truncation is documented rather than discovered.
GeoPackage: the one to prefer
GeoPackage is a single SQLite file that holds multiple layers, preserves field names and types, stores coordinate systems properly and handles very large datasets. It is an OGC standard supported by QGIS, ArcGIS, GDAL, PostGIS and every modern toolchain.
If your recipient's software supports it, GeoPackage is almost always the correct answer for delivery, and GeoJSON is the correct answer for the web layer built from it.
What to ask for, by situation
| Situation | Ask for |
|---|---|
| Points into a spreadsheet or BI tool | CSV, plus Excel if identifiers have leading zeros |
| Web map or API | GeoJSON, or vector tiles above 50 MB |
| Analysis in QGIS or ArcGIS | GeoPackage |
| A colleague insists on shapefiles | Shapefile plus a field-name mapping table |
| Loading into a database | Direct PostGIS load, or GeoPackage |
| Archiving for reuse | GeoPackage plus a plain-text schema description |