Search code examples
openstreetmapoverpass-api

Query from OpenStreetMap


At the moment I'm using the Overpass API to query from OpenStreetMap using https://overpass-turbo.eu/ but when I use the following code, not all the schools in the area appear on the map (e.g. Holy Cross College doesn't appear).

area[name = "Council of the City of Ryde"];
node(area)[amenity = school];
out;

Anyone know why this might be the case?

Thanks for any help!


Solution

  • OpenStreetMap data consists of three basic elements: nodes, ways and relations. Your query searches only for nodes. Some schools will be mapped as ways and a few others as relations.

    You have to change your query in order to search for all three elements:

    area[name = "Council of the City of Ryde"];
    (
    node(area)[amenity = school];
    way(area)[amenity = school];
    relation(area)[amenity = school];
    );
    out;
    

    Alternatively just use the keyword nwr to search for all three elements:

    area[name = "Council of the City of Ryde"];
    nwr(area)[amenity = school];
    out;
    

    If there are still missing schools then either they are mapped with a different tag or they are missing in OSM. In the second case feel free to add them yourself.