GeoJSON vs Shapefile vs KML vs GeoPackage: Which GIS File Format Should You Actually Use?
Shapefile, GeoJSON, KML, and GeoPackage solve different problems and each has a real gotcha that causes bugs. Here's the actual structure behind each format.
GeoJSON vs Shapefile vs KML vs GeoPackage: Which Should You Use?
Four formats, four different jobs — and each one has a real, well-documented quirk that causes genuine bugs if you don’t know it’s there. Here’s what each format actually is, its hard technical limits, and the specific gotcha that trips people up.
Shapefile: The Legacy Standard With Real Limits
Despite the name, a “shapefile” is never one file — it’s a set of at least three: .shp (geometry), .dbf (attribute table), and .shx (index), commonly with a .prj for projection info. Lose any one of the required files and the whole layer stops working. The format also carries hard technical ceilings from its 1998 design: a 2GB size limit on both the .shp and .dbf components (roughly 70 million point features max), a 10-character limit on attribute field names, a 255-field maximum, and — most restrictively — one geometry type per file, so a layer can’t mix points, lines, and polygons together. Convert a shapefile’s .shp/.dbf/.prj set to GeoJSON with the Shapefile to GeoJSON Converter.
GeoJSON: The Web-Native, Spec-Strict Format
GeoJSON is plain JSON, which makes it human-readable and cleanly diffable in version control — a real advantage over binary formats. It’s governed by a formal specification, RFC 7946, which mandates something a lot of people get wrong: coordinates must be in WGS84, expressed as decimal degrees, with longitude listed before latitude — the opposite order from how most people say coordinates out loud (“40.7, -74.0” reads as lat, long; a valid GeoJSON position is [-74.0, 40.7], long first).
Swapping the order silently plots a point in the wrong place — often the wrong hemisphere entirely
GeoJSON also has no built-in spatial index, so very large datasets can get slow to query without an external index. Validate a file against RFC 7946 (including ring closure and coordinate bounds) with the GeoJSON Validator & Formatter, or bring in geometry from a PostGIS query with the WKT to GeoJSON Converter.
KML/KMZ: Built for Visualization, Not Analysis
KML started as Keyhole, Inc.’s format for Google Earth (Google acquired Keyhole in 2004), became an official OGC standard in 2008 (version 2.2), and was refined again as 2.3 in 2015. It’s XML-based and built around rich visual presentation — icons, colors, camera viewpoints, and time animation — rather than pure spatial analysis. KMZ is simply a zipped KML. One specific gotcha: KML colors use aabbggrr hex order (alpha, blue, green, red) — the reverse of the standard web #rrggbbaa convention — which silently produces the wrong color if you paste in a normal CSS hex value without reversing it. Convert Google Earth KML/KMZ files to GeoJSON with the KML to GeoJSON Converter.
GeoPackage: The Modern Shapefile Replacement
GeoPackage (.gpkg), ratified as an OGC standard in 2014, is a single SQLite database file that can hold multiple vector layers, raster tiles, and attribute tables together — directly solving Shapefile’s biggest pain points. No 2GB size ceiling, no 10-character field name limit, full UTF-8 support, and one file to manage instead of three or more. It’s increasingly the recommended replacement for Shapefile in modern GIS workflows. Convert between GeoPackage and the other formats with the GPKG to GeoJSON Converter and GPKG to Shapefile Converter.
The Format Comparison at a Glance
GeoPackage and GeoJSON solve Shapefile's file-count and size problems in different ways
| Task | Recommended Format |
|---|---|
| Web mapping (Leaflet, Mapbox, browser JS) | GeoJSON |
| Sharing with non-GIS users, Google Earth visualization | KML/KMZ |
| Legacy software with minimal format support | Shapefile (aware of its limits) |
| Modern desktop GIS, large or multi-layer datasets | GeoPackage |
Frequently Asked Questions
Why does GeoJSON list longitude before latitude?
It’s a deliberate RFC 7946 specification requirement, matching the general x-then-y convention used elsewhere in geometry — but it’s the opposite of how coordinates are usually spoken aloud, which makes it a common source of silently swapped, wrong-location bugs.
Can GeoPackage really replace Shapefile completely?
For nearly all practical purposes, yes — it removes Shapefile’s size ceiling, field name limit, and multi-file fragility while adding multi-layer and raster support in a single file, which is why OGC and most modern GIS software treat it as the recommended successor.
Why is a Shapefile actually several files instead of one?
Its original 1998 design separated geometry (.shp), attributes (.dbf), and spatial index (.shx) into distinct files — a structure that’s stuck around for compatibility even though it makes the format fragile to share or move.
Is KML good for spatial analysis?
Not particularly — it’s built around visual presentation (icons, styling, camera views) for tools like Google Earth rather than the geometric precision and indexing that analysis workflows need.
What’s the real-world impact of Shapefile’s 2GB limit?
Large modern datasets — high-resolution boundary data or dense point clouds — can exceed it outright, forcing a split into multiple shapefiles or a switch to a format like GeoPackage that has no such ceiling.
Related Calculators
Convert legacy data with the Shapefile to GeoJSON Converter and KML to GeoJSON Converter, move to the modern single-file format with the GPKG to GeoJSON Converter and GPKG to Shapefile Converter, bring in database geometry with the WKT to GeoJSON Converter, and check spec compliance with the GeoJSON Validator & Formatter.
External Resources
- RFC 7946 — The GeoJSON Format — the official IETF specification, including the coordinate order requirement
- OGC GeoPackage Standard — the official Open Geospatial Consortium standard page