Search code examples
openstreetmapoverpass-api

Is it possible to get all OSM nodes (are not belong to any way) using the Overpass API?


I want to get all OSM nodes (are not belong to any way).
Is it possible?

Understandably, this query get all nodes (includes member of ways)...

<osm-script output="json">
    <query type="node">
      <bbox-query {{bbox}}/>
    </query>
    <print/>
</osm-script>

Update 19 Sep 20:20(GMT+9:00)

I tried tyr's query and success!

enter image description here


Solution

  • Actually, this is possible since the latest version of Overpass API:

    <osm-script output="json">
      <query type="way">
        <bbox-query {{bbox}}/>
      </query>
      <recurse type="way-node" into="waynodes"/>
      <query type="node" into="allnodes">
        <bbox-query {{bbox}}/>
      </query>
      <difference>
        <item set="allnodes"/>
        <item set="waynodes"/>
      </difference>
      <print/>
    </osm-script>
    

    http://overpass-turbo.eu/s/14F

    This uses the difference operator to subtract nodes that are member of any ways from all of the nodes.