Search code examples
openstreetmapoverpass-api

Overpass query. Absence of [maxsize] returns significantly smaller results


I have two overpass queries.

node(33.68336,-117.89466,34.14946,-117.03498);
way["highway"~"motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|road|residential|service"](bn);
(._;>;);
out;

The query above returns an osm.xml file that is 167.306 kb big.

[out:xml][maxsize:2000000000];
(
    node(33.68336,-117.89466,34.14946,-117.03498);
    way["highway"~"motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|seconda ry_link|tertiary|tertiary_link|road|residential|service"](bn);
    (._;>;);
);
out;

The second query returns a file that is 618.994 kb big. Why does the second query return a significantly bigger result? Does the first query not give me the full dataset? Is there a way to get the same result with both queries? (The absence of [maxsize] sometimes leads to an error…)


Solution

  • I feel that there is something missing about your query:

    node(33.68336,-117.89466,34.14946,-117.03498); should return all the nodes in this area,which is a lot of data.

    box

    then the second line:

    way"highway"~“motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|road|residential|service”;

    gives an error, as it should be written with brackets and straight quotes as so:

    way["highway"~"motorway|motorway_link|trunk|trunk_link|primary|primary_link|secondary|secondary_link|tertiary|tertiary_link|road|residential|service"]; but this looks for all the roads in the world, and your first query is not used any more, as your output is only the second query. But that is a huge amount of data, probably in the GB range.

    So I don't see how you would get only 167 kB. I assume you must a bounding box or some other filter that you did not mention.

    But in your second example, you make an union of the two queries, as you put them in brackets: (... ; ...;); out; so you would get all the nodes in the area and all the roads in the world. And again, if you have an extra bounding box or filter, you might get only 619 kB. Supposing that there are a lot of non-road nodes, it makes sense that you get more data, as you get the union of the two searches (all nodes + nodes from the roads)