The Complete Guide to GeoJSON (RFC 7946) & Modern Spatial Data Architecture
GeoJSON is an open, JSON-based format for encoding a variety of geographic data structures. Formally standardized by the Internet Engineering Task Force (IETF) in RFC 7946, GeoJSON provides a human-readable, machine-parsable grammar that bridges the gap between Geographic Information Systems (GIS) like QGIS or Esri ArcGIS and modern web mapping libraries including Mapbox GL JS, Leaflet, and OpenLayers.
From urban planning parcel boundaries and environmental conservation zones to fleet telemetry trails and autonomous driving road networks, GeoJSON is the universal interchange standard for location intelligence. Opening spatial datasets in standard text editors presents a dizzying wall of floating-point coordinate arrays without spatial context. The HiFi Toolkit Online GeoJSON Viewer transforms raw coordinate dumps into an interactive vector map, allowing developers to inspect geometric contours, review non-spatial property attributes, and validate coordinate compliance in real time.
The 7 Core Geometry Primitives & Feature Containers
GeoJSON structures spatial information through distinct geometric abstractions encapsulated within feature wrappers:
Points, Lines & Multi-Geometries
A Point represents a single geographical position ([lon, lat]). A LineString connects two or more positions to model roads, rivers, or flight paths. Multi-variants (MultiPoint, MultiLineString) bundle related disconnected geometries into a single entity.
Polygons & The Right-Hand Rule
A Polygon represents an enclosed surface defined by an array of linear rings. Under RFC 7946, the outer exterior boundary MUST follow a counter-clockwise winding order, while any inner cutout rings (donut holes) MUST follow a clockwise winding order.
| GeoJSON Structure | JSON Coordinate Array Syntax | Real-World Geographic Application |
|---|---|---|
| Point | [ -122.4194, 37.7749 ] | Store locations, delivery destinations, IoT weather stations. |
| LineString | [ [lon1, lat1], [lon2, lat2], ... ] | Highways, hiking trails, utility pipelines, transit bus routes. |
| Polygon | [ [ [lon, lat], ... ], [ [hole], ... ] ] | Real estate land parcels, electoral voting districts, municipal borders. |
| MultiPolygon | [ [ [ [lon, lat], ... ] ], [ ... ] ] | Nations comprising archipelagos or non-contiguous island territories. |
| FeatureCollection | { "type": "FeatureCollection", "features": [...] } | Standard container grouping multiple geographic shapes with attributes. |
Coordinate Standards: WGS 84 (EPSG:4326) & The Longitude/Latitude Trap
By far the most notorious source of bugs in spatial software development is coordinate axis confusion:
The Common Trap: Lat/Lon ([Y, X])
In conversational speech, humans say "Latitude and Longitude" (e.g., 37.7749° N, 122.4194° W). However, mathematical cartesian coordinate systems place the horizontal X axis (Longitude) before the vertical Y axis (Latitude). Inverting these coordinates causes points in North America to render in Antarctica or the Indian Ocean.
The RFC 7946 Standard: Lon/Lat ([X, Y])
GeoJSON strictly mandates [longitude, latitude, elevation]. Longitude ranges from -180.0 to +180.0 degrees (East/West), and latitude ranges from -90.0 to +90.0 degrees (North/South). Our viewer validates coordinate boundaries to immediately flag inverted inputs.
Common GeoJSON Validation Failures & Troubleshooting Guide
When working with raw spatial files, audit for these standard compliance pitfalls:
- Unclosed Linear Rings: In Polygon and MultiPolygon definitions, the first coordinate pair and the final coordinate pair must be mathematically identical (e.g.,
[lon1, lat1] === [lonN, latN]) to create a closed loop. - Antimeridian Crossing (180th Meridian): Features that span across the International Date Line (such as Fiji or Alaska's Aleutian Islands) must be split into separate geometries at -180° / +180° to prevent global wrapping rendering artifacts.
- Excessive Coordinate Precision: Storing 15 decimal digits (e.g.,
37.77492940294123) balloons file sizes without increasing practical accuracy. Six decimal places provide sub-meter precision (approx. 0.1 meters), which is more than sufficient for street-level mapping. - The Right-Hand Rule (Winding Order): RFC 7946 mandates that exterior polygon boundary rings must follow a counter-clockwise (CCW) winding order, whereas interior rings bounding holes or interior enclaves must follow a clockwise (CW) direction. Violating winding orientation leads to clipping artifacts during vector tile rasterization.
Spatial Data Formats: GeoJSON vs. TopoJSON vs. Shapefile
Modern GIS pipelines select transmission and storage formats according to bandwidth, indexing, and topology constraints:
| Format | Data Paradigm | Topology & Shared Borders | Target Production Ecosystem |
|---|---|---|---|
| GeoJSON | Human-readable JSON | Redundant vertices across adjacent borders | Web applications, REST APIs, Leaflet, Mapbox GL, and OpenLayers. |
| TopoJSON | Arc-indexed JSON | Eliminates duplication via shared boundary arcs | D3.js thematic choropleth maps; achieves 80% file size reduction. |
| Shapefile (.shp) | Legacy binary bundle | Separate .shp, .shx, .dbf files | Desktop GIS (Esri ArcGIS, QGIS); restricted by 2 GB table size limits. |
| FlatGeobuf | Binary FlatBuffers | Includes packed R-Tree spatial index | Cloud-native GIS; enables HTTP range requests for massive vector layers. |
Spatial Indexing & Bounding Box (bbox) Acceleration
GeoJSON specifications allow an optional "bbox" property formatted as [minX, minY, maxX, maxY] (e.g., [-122.5, 37.7, -122.3, 37.9]). Including precomputed bounding boxes enables client mapping libraries and WebGL shaders to execute instant viewport frustum culling. Instead of evaluating tens of thousands of complex interior vertices, the map engine discards features outside the current screen view, guaranteeing smooth 60fps panning.
Geometry Simplification & CRS Normalization
High-resolution coastline and cadastral shapefiles frequently contain millions of redundant vertices that degrade web rendering speeds. Developers employ the Ramer-Douglas-Peucker (RDP) algorithm or Visvalingam-Whyatt area-elimination algorithm to discard extraneous points within a configurable perpendicular epsilon threshold, decreasing payload sizes by up to 90% while preserving recognizable cartographic silhouettes. Furthermore, while historical GeoJSON standards permitted custom "crs" objects, RFC 7946 formally removed arbitrary projected coordinate systems, standardizing exclusively on the WGS 84 datum with longitude and latitude expressed in decimal degrees.
100% Client-Side Privacy & Data Security Assurance
Geospatial files frequently contain highly sensitive proprietary business information: commercial real estate parcel acquisition boundaries, telecommunication dark fiber route paths, proprietary mining claim coordinates, and defense sector mapping data. Transmitting private GIS files to external web map converters creates severe intellectual property exposure and regulatory compliance risks.
HiFi Toolkit strictly enforces a zero-server privacy architecture. All GeoJSON parsing, coordinate bounding calculations, polygon tessellation, and map rendering execute 100% locally within your client web browser memory using sandboxed JavaScript. Not a single spatial coordinate, parcel boundary, or attribute record is ever transmitted over the network or persisted to remote servers. This offline-capable client execution architecture ensures complete field usability in air-gapped defense, mining, and secure intelligence installations. Zero telemetry beacons, analytics tracking, or external logging scripts are invoked during your analysis. Every geographic feature and associated property record is instantly and permanently purged from browser RAM the moment the session closes.
