Dear all, Overpass API 0.7 has finally reached its long expected version 0.7: http://wiki.openstreetmap.org/wiki/Overpass_API/versions
There are essentially three major changes: In addition to bounding boxes, now also polygons can be used to cut out a region for download. http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_Polygon A simple example is a part of my home town in Germany: http://overpass-api.de/api/interpreter?data=(node(poly:"50.7+7.1+50.7+7.12+50.71+7.11");<;);out; More general, almost all examples from http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Sample_map_calls 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. http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_Area http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_Tag http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Query_for_Areas If you want to download a city (with well-formed boundary), for example the medium German town Alfter, you can just use http://overpass-api.de/api/interpreter?area[name="Alfter"];(node(area);<;);out; Again, the (area) clause is yet restricted to nodes, but the Map Call Examples http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Sample_map_calls 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: http://overpass-api.de/api/interpreter?data=is_in(50.75,7.21);out; 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: http://overpass-api.de/api/interpreter?data=[out:json];is_in(50.75,7.21);out; (works also with all other examples) Do you want to know where else on the world are placed named "Birlinghoven"? Just call http://overpass-api.de/api/interpreter?data=[out:json];node[name~"Röttgen"];foreach(out;is_in;out;); or more concise http://overpass-api.de/api/interpreter?data=[out:json];node[name~"Röttgen"];foreach(out;is_in;area._[admin_level~"6|8"];out;); 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 http://www.overpass-api.de/command_line.html#headers 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, Roland _______________________________________________ talk mailing list talk@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk