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 JSON (JavaScript Object Notation). It represents geographic features and their properties in a structure that is both human-readable and machine-parseable. The format is defined in RFC 7946.

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 GeoJSON file through App Store Connect that defines the geographic areas where the app can provide directions. Apple Maps uses this file to determine when to offer your app as a routing option.

Common Pitfalls

The most frequent GeoJSON mistake is coordinate order. GeoJSON uses longitude-latitude order, which is the opposite of what most people expect (latitude-longitude). Swapping these causes your polygons to appear on the wrong side of the world.

Other common issues include unclosed polygon rings (the first and last coordinates must be identical), 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