I need to get from OSM all all nodes in the bounding box, all ways referring to any of these nodes, all member nodes of these ways whether these are inside the bounding box or not, all relations that have such a node or such a way as a member, and their node and way member, and even the nodes of these ways.

According to: https://wiki.openstreetmap.org/wiki/Overpass_API/Advanced_examples I use this query:

out meta;

From the browser, using overpass turbo, I call url:


and get a complete 84.2 MB .osm file

If I use wget according to http://overpass-api.de/command_line.html:

wget -O target.osm "https://overpass-api.de/api/interpreter?data=node(45.54,9.19,45.55,9.2);<;>;out meta;

I get a 79.9 MB .osm incomplete file, without some ways in the box. Why the 2 results are different?

1 Answer 1


It seems you forgot to include the union statement (the two round brackets) in your second example. They're necessary to include nodes, ways, and all nodes referred to by ways in your response. If you leave them out, you will only receive an incomplete answer.

(           // <<<<<<< start of union statement
);          // <<<<<<< end of union statement
out meta;

To avoid this mistake in the future, you can enter your query in overpass turbo, then hit "Export" -> "raw data directly from Overpass API". This will create a download link suitable for wget right away.

  • wget -O target.osm "https://overpass-api.de/api/interpreter?data=(node(45.54,9.19,45.55,9.2);<;>);out meta;" return 400: Bad Request. As you suggest I use the download link and wget -O target.osm "https://overpass-api.de/api/interpreter?data=%28%0Anode%2845.54%2C9.19%2C45.55%2C9.2%29%3B%0A%20%3C%3B%0A%20%3E%3B%0A%29%3B%0Aout%20meta%3B" works well. Anyway I'd prefer the first solution with a more readable url just because I have to use wget in a bash script with box coordinates as parameter. @mmd any idea why first wget return 400 Error?
    – franco_b
    Commented May 13, 2022 at 8:45
  • You forgot one semicolon ";" character right before the closing round bracket.
    – mmd
    Commented May 13, 2022 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.