Note: This page describes the development version of GPSBabel. It may substantially differ from the latest released GPSBabel.

GeoJson (geojson)

This format can...

  • read and write waypoints

  • read and write tracks

  • read and write routes

This format has the following options: compact .

This module supports a subset of the GeoJSON format.

GeoJSON is a poor fit for GPSBabel's internal data structures as GPSBabel was designed more around common GPS features (waypoints, tracks, routes) than about GIS-style concepts like MultiPolygons or Geometry Collections. In reality, for all but the most simple uses (such as converting a format that GPSBabel supports well to something like Leaflet, you should not expect high fidelity transfers through this format.

Waypoints are mapped to a FeatureCollection of Points. The properties for name and description are written, where available. Tracks are converted to a LineString. MultiPoint are converted to Waypoints. LineString, Polygon and MultiPolygon are converted to routes. MultiLineString are converted to tracks.

The potentially nested/recursive nature of GeoJSON in general would be an awkward implementation.

Initial development was free-handed by looking at the GeoJSON RFC. Corner cases were handled by using GDAL's ogr2ogr to convert GPX to JSON and compare the output. The results were then JSON validated and viewed on JSON web viewer.

compact option

Compact Output. Default is off..

This option, when set, reduces the amount of whitespace in the generated GeoJSON. This reduces the size, especially when uncompressed, but reduces the readability to humans.