[OSM-talk] Overpass API v0.7: Polygons, Areas and more

Roland Olbricht roland.olbricht at gmx.de
Tue Nov 6 08:52:24 GMT 2012

Dear all,

Overpass API 0.7 has finally reached its long expected version 0.7:

There are essentially three major changes:

In addition to bounding boxes, now also polygons can be used to cut out a
region for download.
A simple example is a part of my home town in Germany:


More general, almost all examples from
can be adapted to the polygon variant. The only restriction is that polygons can only be used as borders for nodes. Please use one of the various recurse statements to get ways and relations from it.

If you want to use a polygon like the output of rel2poly as a boundary, you can convert it with the following script:

#!/usr/bin/env bash

echo -n '(node(poly:"'
awk '{ if ($1 != "1" && $1 != "polygon" && $1 != "END") printf $2" "$1" "; }'
echo '");<;);out;'

and then send the output (let's call it "request.txt") with

wget --post-file=request.txt http://overpass-api.de/api/interpreter

The second change improves area handling.
If you want to download a city (with well-formed boundary), for example the medium German town Alfter, you can just use


Again, the (area) clause is yet restricted to nodes, but the Map Call Examples
show how to get the complete data of the desired flavor from this.

In the back direction, you can use the improved coord query to almost do reverse Geocoding:


tells you in which city and country I currently are (latitude 50.75, longitude 7.21). For those, who prefer JSON, the same thing in JSON:


(works also with all other examples)

Do you want to know where else on the world are placed named "Birlinghoven"? Just call


or more concise


And, chaining operators makes that possible also for streets:

http://overpass-api.de/api/interpreter?data=[out:json];way[name~"Elberfelder Straße"];foreach(out;>;is_in;area._[admin_level~"6|8"];out;);

... unless you are hit by way too much results :)

The third change is different handling of HTTP headers. This is a highly technical matter, mostly to enable proper CORS. Additionally, syntactically malformed requests now get a "400 Bad Request" reply to conform to standards. Please see

I'm happy that I have been able to address with this extensions several feature requests. The next version will exclusively care on a proper migration to 64-bit node ids. As Overpass API uses unsigned integers, I have about three years time to do that, but I'm confident to be faster :)
I expect that be done before Christmas and the next round of feature requests to be implemented in January.

Happy querying,


More information about the talk mailing list