development
GeoJSON
A lightweight, open-standard data format for encoding geographic features like points, lines, and polygons using JSON. Used in iOS routing app coverage files and location-based services.
GeoJSON is a geospatial data interchange format based on JavaScript Object Notation (JSON). It represents geographic features and their properties in a structure that is both human-readable and machine-parseable. RFC 7946 defines the format.
GeoJSON Structure
A GeoJSON file consists of Features organized in a FeatureCollection. Each Feature has a geometry (the shape) and properties (the metadata):
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": { "name": "Dublin" },
"geometry": {
"type": "Polygon",
"coordinates": [[ [lon, lat], [lon, lat], ... ]]
}
}]
}
Geometry Types
- Point - a single location (longitude, latitude)
- LineString - a path defined by connected points
- Polygon - a closed area defined by a ring of coordinates
- MultiPoint, MultiLineString, MultiPolygon - collections of the above
GeoJSON in iOS Development
Apple uses GeoJSON for routing app coverage files. Transit and navigation apps must submit a coverage file through App Store Connect that defines the geographic areas where the app can provide directions. Apple Maps reads this file to determine when to offer your app as a routing option.
Common Pitfalls
The most frequent GeoJSON mistake is coordinate order. The format uses longitude-latitude order, the opposite of what most people expect. Swapping these values places your polygons on the wrong side of the world.
Other common issues include unclosed polygon rings (the first and last coordinates must match), self-intersecting polygons, and excessive coordinate precision that bloats file size.
Tools
- geojson.io - browser-based editor for creating and visualizing GeoJSON
- mapshaper.org - simplify complex geometries to reduce file size
- QGIS - full-featured GIS application for advanced geospatial work
- Shapely (Python) - programmatic geometry creation and manipulation