OSM JSON

From OpenStreetMap Wiki
Jump to navigation Jump to search


Basics

OSM API JSON format is based on the Overpass API JSON format with only minor differences in the header fields (see below). It is available since March 2020 and supported by both the Rails port (since commit Blacktocat.svg openstreetmap/openstreetmap-website/commit/73c9584) and CGImap (since version 0.8.0).


Example OSM JSON file

Here is a shortened, pretty-printed example of a complete OSM JSON file. Not every OSM JSON file will contain all of these types of elements. See more in the notes below.

Example: https://api.openstreetmap.org/api/0.6/relation/10000000/full.json

(Note that the OSM API response is not pretty printed.)

{
  "version": "0.6",
  "generator": "CGImap 0.8.1 (6263 thorn-01.openstreetmap.org)",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "elements": [
    {
      "type": "node",
      "id": 35352001,
      "lat": 50.2106234,
      "lon": 8.5856189,
      "timestamp": "2012-12-08T23:04:02Z",
      "version": 6,
      "changeset": 14206963,
      "user": "HoloDuke",
      "uid": 75317
    },
    {
      "type": "node",
      "id": 35352063,
      "lat": 50.2121617,
      "lon": 8.5867523,
      "timestamp": "2018-11-21T20:52:44Z",
      "version": 4,
      "changeset": 64755187,
      "user": "Jonaes",
      "uid": 4433367
    },
    {
      "type": "node",
      "id": 6772305769,
      "lat": 50.2106895,
      "lon": 8.5857061,
      "timestamp": "2019-09-04T15:05:00Z",
      "version": 1,
      "changeset": 74092935,
      "user": "Jonaes",
      "uid": 4433367,
      "tags": {
        "bicycle": "yes",
        "information": "guidepost",
        "ref": "OU.425.1",
        "tourism": "information"
      }
    },
    {
      "type": "way",
      "id": 5123563,
      "timestamp": "2019-09-04T15:05:00Z",
      "version": 7,
      "changeset": 74092935,
      "user": "Jonaes",
      "uid": 4433367,
      "nodes": [
        35352060,
        35352061,
        35352062,
        35352063,
        2056819178,
        35352001
      ],
      "tags": {
        "bicycle": "yes",
        "foot": "yes",
        "highway": "track",
        "horse": "yes",
        "lcn": "yes",
        "motor_vehicle": "agricultural;forestry",
        "surface": "asphalt",
        "tracktype": "grade1",
        "traffic_sign": "DE:260,DE:1026-36"
      }
    },
    {
      "type": "relation",
      "id": 10000000,
      "timestamp": "2019-09-18T18:21:44Z",
      "version": 2,
      "changeset": 74641141,
      "user": "HoloDuke",
      "uid": 75317,
      "members": [
        {
          "type": "node",
          "ref": 6772305769,
          "role": "sign"
        },
        {
          "type": "node",
          "ref": 35352001,
          "role": "intersection"
        },
        {
          "type": "way",
          "ref": 5123563,
          "role": "to"
        }
      ],
      "tags": {
        "bicycle": "yes",
        "colour:arrow": "green",
        "colour:back": "white",
        "colour:text": "green",
        "destination": "Friedrichsdorf;Bad Homburg",
        "destination:symbol": ";train_station",
        "distance": "8.0;4.6",
        "type": "destination_sign"
      }
    }
  ]
}

See Elements for details of the object categories.
See Map features about how real world objects are modeled and categorized.

Flavours

Overpass API

  • JSON format is pretty-printed.
  • Contains an additional "osm3s" element with timestamp and copyright information
  • copyright, attribution and license fields vary compared to OSM API JSON format.
{
  "version": 0.6,
  "generator": "Overpass API 0.7....",
  "osm3s": {
    "timestamp_osm_base": "2020-01-01T00:00:02Z",
    "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
  },
  "elements": [



  ]
}


See also