GeoJSON vs. KML vs. GPX: Vector GIS Formats Compared

Comparison Summary Table

Format Structure Coordinate Order Primary Use Case
GeoJSON JSON (RFC 7946) [Longitude, Latitude, Altitude] Web mapping (Leaflet, Mapbox, OpenLayers)
KML XML (OGC Standard) <coordinates>lon,lat,alt</coordinates> Google Earth 3D visualization & styling
GPX XML (GPS Exchange) <wpt lat="..." lon="..."> GPS devices, fitness apps, elevation tracks

1. The Infamous Coordinate Ordering Pitfall

The single biggest cause of bugs when switching between GIS formats is the coordinate array order:

  • GeoJSON Spec (RFC 7946): Coordinates MUST be formatted as [Longitude, Latitude] (X then Y). Example: [139.6917, 35.6895].
  • Human Speech & Form Inputs: Usually stated as "Latitude, Longitude" (Y then X). Example: 35.6895, 139.6917.
  • GPX Schema: Attributes are explicitly named lat="..." lon="..." to avoid ambiguity.

Interactive GeoJSON / WKT Bounding Box & Centroid Extractor

Paste a GeoJSON Feature or WKT Geometry string below to extract exact center coordinates and bounding box: