Overpass API >

Command line

To download data (by hand or in a script) from Overpass API, you can use for example the well-known program wget. Alternatives are for example curl or, in case of FreeBSD, fetch. We assume here that you plan to use it in a script or other non-interactive way, because otherwise the query form might be a more convenient alternative.

The possible formats of the downloaded file are described on the output formats page.

For short queries, the usage is very simple: Just write the query in the command line:

wget "http://overpass-api.de/api/interpreter?data=node[name=\"Gielgen\"];out;"

Please note that we need to escape the quotation mark ("). Because we have enclosed the URL in quotation marks, we must escape only two more characters: the dollar ($) sign should get (\$) and the backslash (\) should be doubled (\\).

In most cases it would be helpful to store the results with a meaningful filename. Use -O for that purpose:

wget -O target.osm "http://overpass-api.de/api/interpreter?data=node[name=\"Gielgen\"];out;"

For longer queries, it could be helpful to have the query in a separate file. That is also possible:

echo "data=node[name=\"Gielgen\"];out;" >query.osm
wget -O target.osm --post-file=query.osm "http://overpass-api.de/api/interpreter"