Overpass turbo/GeoJSON

From OpenStreetMap Wiki
Jump to navigation Jump to search
Overpass API logo.svg
edit
Overpass API · Language reference · Language guide · Technical terms · Areas · Query examples · Sparse Editing · Permanent ID · FAQ · more · Web site
Servers status · Versions · Development · Technical design · Installation · XAPI compatibility layer · Public transport sketch lines · Applications · Source code and issues
Overpass turbo · Wizard · Overpass turbo shortcuts · MapCSS stylesheets · Export to GeoJSON · more · Development · Source code and issues · Web site
Overpass Ultra · Examples · Overpass Ultra extensions · MapLibre stylesheets · URL Params · more · Source code and issues · Web site

GeoJSON is an open format for encoding a geographic data. Here is some description about the structure of the GeoJSON exported by overpass turbo.

Overpass turbo uses the osmtogeojson library to convert the raw OSM data output it gets from the Overpass API to GeoJSON.

Structure

All data is given as a FeatureCollection. The following metadata is given at this level:

  • generator: the name of the application generating the data (i.e. "overpass-turbo")
  • copyright: the copyright attribution as given by the data source
  • timestamp: the timestamp as given by the data source

Each Feature in the collection has the member properties containing the following data:

  • @id: an id identifying the object, formed from the OSM datatype (node, way, relation) and the OSM id (e.g. node/123, way/4321, …).
  • all tags of the OSM object[1]
  • meta-data (if available) - encoded with a beginning @ (@timestamp, @version, @changeset, @user, @uid)
  • @tainted: if present: indicates that the feature's geometry is incomplete
  • @relations: an array of relations the object is member of. Each relation is encoded as an object literal containing the following properties: role (membership role), rel (the relation's id) and reltags (contains all tags of the relation).

The geometry is standard GeoJSON.

Contained Data

GeoJSON produced by overpass turbo will include exactly one GeoJSON-feature for each of the following OSM objects (that is everything that is also visible in overpass turbo's map view):

  • all ways[2]
  • all tagged[3] or unconnected nodes ("POIs")
  • all multipolygons[4]

It doesn't contain some data which can be returned by Overpass API (for example: Overpass areas, objects without coordinates, way-nodes, etc.) and arbitrary relations are only present via their childs. So, there is no 1:1 relationship between OSM Data and the exported GeoJSON.

Example Output

{
  "type": "FeatureCollection",
  "generator": "overpass-turbo",
  "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.",
  "timestamp": "2013-04-25T08:50:03Z",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "@id": "way/181440866",
        "landuse": "meadow",
        "@timestamp": "2012-09-17T13:06:55Z",
        "@version": "1",
        "@changeset": "13143419",
        "@user": "tyr_asd",
        "@uid": "115612",
        "@relations": [
          {
            "role": "inner",
            "rel": "130768",
            "reltags": {
              "landuse": "forest",
              "type": "multipolygon"
            }
          }
        ]
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              11.2070535,
              46.4834059
            ],
            [
              11.2067411,
              46.483376
            ],
            [
              11.2066324,
              46.4830587
            ],
            /* -- snip -- */
            [
              11.2070535,
              46.4834059
            ]
          ]
        ]
      },
      "id": "way/181440866"
    },
    {
      "type": "Feature",
      "properties": {
        "@id": "way/119434107",
        "highway": "path",
        "ref": "500",
        "sac_scale": "mountain_hiking",
        "@timestamp": "2011-09-14T11:41:32Z",
        "@version": "2",
        "@changeset": "9298589",
        "@user": "tyr_asd",
        "@uid": "115612",
        "@tainted": true,
        "@relations": [
          {
            "role": "",
            "rel": "1537588",
            "reltags": {
              "network": "rwn",
              "operator": "Società degli Alpinisti Tridentini",
              "osmc:symbol": "red:red:white_bar:500:black",
              "ref": "500",
              "route": "hiking",
              "type": "route"
            }
          }
        ]
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            11.2071162,
            46.4838528
          ],
          [
            11.2068518,
            46.4829
          ],
          [
            11.207187,
            46.481963
          ],
          [
            11.207199,
            46.481105
          ]
        ]
      },
      "id": "way/119434107"
    }
  ]
}

Footnotes

  1. tags beginning with an @ sign will be escaped by an additional @ in front
  2. except those that are untagged and only form the outline of a multipolygon
  3. "uninteresting" tags such as created_by and source are ignored for this
  4. simple multipolygons with exactly one closed outer way are present via their outer way