Search code examples
openstreetmapoverpass-api

What are "Nodes" and "Ways" in overpass API


I'm using overpass api and would like to understand the difference between a Node and a Way. Below is an xml snippet for each. I would appreciate if anyone knew what the number values mean and how they relate to the real world. Also what is the difference between a node with tags and one without.

<way id="4600886">
  <nd ref="27605443"/>
  <nd ref="30346321"/>
  <nd ref="1705297211"/>
  <nd ref="391210257"/>
  <nd ref="390384217"/>
  <nd ref="391210271"/>
  <nd ref="32343771"/>
  <nd ref="391210305"/>
  <nd ref="391210664"/>
  <nd ref="97175448"/>
  <tag k="highway" v="secondary"/>
  <tag k="lanes" v="2"/>
  <tag k="name" v="Days Road"/>
  <tag k="surface" v="asphalt"/>
</way>


<node id="18615430" lat="44.2384337" lon="-76.5411605">
  <tag k="created_by" v="r_coastlines"/>
  <tag k="source" v="PGS"/>
</node>

Solution

  • First of all, this question is not at all about Overpass API - that's the normal OpenStreetMap object model with nodes, ways and relations.

    The ref values as such don't have any meaning, they're database internal object ids. However, A way may reference a node via its id as an example. Geographic lat/lon information is always stored in nodes. And of course, some nodes may have tags, if they represent a node-like object in real life (could be an amenity or maybe a stop-sign). For a highway (=way which uses a number of nodes), the individual nodes don't need to have any tag at all.

    Some recommended reading:

    1. http://wiki.openstreetmap.org/wiki/Elements
    2. http://wiki.openstreetmap.org/wiki/OSM_XML
    3. http://wiki.openstreetmap.org/wiki/OSM_file_formats
    4. https://www.mapbox.com/mapping/osm-data-model/