Search code examples
openstreetmapoverpass-api

Get all nodes within


I'm currently working on a project that requires me to get all nodes of the previous results with a certain tag. The following code gets all nodes of the way, but I can't figure out how to only get the nodes with a certain tag.

[out:json][timeout:25];

(way["railway"="tram"](47.36889,8.55407,47.36973,8.55553));

out;
>;
//get all nodes within the result with a certain tag
out;

Solution

  • Try this query:

    [out:json][timeout:25];
    
    way["railway"="tram"](47.36889,8.55407,47.36973,8.55553);
    >;
    node._["public_transport"="stop_position"];
    out;
    

    It queries for all ways with a railway=tram tag in the given bounding box. Then it performs a recurse up (>;) to get all nodes of these ways . Afterwards it searches for nodes in the default set _ with a public_transport=stop_position tag.