Talk:Overpass API

From OpenStreetMap Wiki
Jump to: navigation, search

Please note server outages or malfunctions on OSM3S/status.

Feedback channel

Is it a feedback channel somewhere ?

Yes. You can write me an eMail at roland(dot)olbricht(at)gmx(dot)de. If you find a malfunction or server outage, please note it on OSM3S/status. If you are subscribed to the mailing list <emph>osm-dev</emph>, you could also write an email there. As this is a spare time project, I won't warrant any reaction time, up to 3 days may happen. --Roland 06:48, 25 October 2011 (UTC)

I've got errors on queries on http://78.46.81.38/api/sketch-route?159059 and other relation ids.

Firefox says :

Erreur d'analyse XML : entité non définie
Emplacement : http://78.46.81.38/api/sketch-route?159059
Numéro de ligne 8, Colonne 20 :<title>Line 2 from &rel_from; to &rel_to;</title>

--FrViPofm 09:22, 20 February 2010 (UTC)

Yes, you can write me an eMail at roland(dot)olbricht(at)gmx(dot)de or just write here. Thank you for pointing me to the error, this should now be corrected. Unfortunatly, this means that these relations show proper error messages: they are bus lines, but they don't have any stops as members. Thus, the generator can't generate a list of stops from them. You could use for example JOSM with the Public Transport Plugin to easily add stops. --Roland 13:00, 21 February 2010 (UTC)

That page starts to be big and we don't really know what are the known bugs and what are those solved. Have you thought about using a bug tracker ? Do you prefere that some developers join you before using more complex bug tracking ? (If that is just a matter of setting that up, I can provide you with an allready installed one if you wish). sletuffe 22:51, 20 December 2012 (UTC)
One day, I'll be searching before asking, in any case here is the bug tracker : [1] if someone search it sletuffe 22:56, 20 December 2012 (UTC)

Licensing

I would be useful to know what kind of usage is acceptable for this API. Can it be used for open source software, how about for comercial software? User:alecdhuse 16:09, 16 February 2012 (UTC)

Do you mean the software or the API service itself ? If the fist, the source code is here on gitorious : http://gitorious.org/osm3s, and although there is no GPL's licence text with the sources, it is licenced as GPL v2 (the author mentionned a bug that prevent from including the GPL text, which I must admit, is rather weird ;-) ) sletuffe 17:28, 16 February 2012 (UTC)
For the software: I'm the author. I'm simply not a lawyer and I have no idea what (license text, links, remarks) to put where (source code, head files only, license file somewhere) to properly express the license. I've seen projects that have put a one-line comment at the top of every file. But I think, the license text must be included somewhere. The rumor of a bug comes from the statement: If had hoped GNU automake would somehow help with placing a license remark (explanation in the manual, auto-adding something somewhere, sample files somewhere). -- Roland 2012-02-16 19h44 UTC
Well I'm not an expert as well, but this might be a little scary that in your source tree there is not a word about the licence (Will that guy try to sue me if I use his software ?). Following : [2] it says you should include a file at the root of your sources with this text http://www.gnu.org/licenses/gpl-2.0.txt and add to every files a line of copyright and a line saying this software is released under GPL v2. sletuffe 22:25, 16 February 2012 (UTC)
For the API. As there is no resource shortage, I have no formal policy yet. The background are the following considerations:
  • All users should have a fair chance of using the service.
  • I don't give any warranty that the server is available or keeps a certain minimum level of performance.
The technical limits are:
  • for all servers: The serializer doesn't process more than roughly 5 queries per second and responds with an error message instead. I could increase the capacity here, but then high load would result in slow queries. I deem the first solution better.
  • for overpass-api.de: There is a total bandwith soft quota of Hetzner at 5 TB per month. Currently, the server uses 0.06 TB. Thus there is much capacity reserve.
  • for overpass.osm-rambler.ru: The server and hosting are kindly donated by Rambler for the OSM community. The figures are similar.
This results in the following usage recommandations:
  • The API may be used for any kind of client and in any organizational model. I don't make restrictions here.
  • Be prepared that more than 5 requests per second may result frequently in error messages.
  • I strongly suggest not to use the API for more than 50 GB per day per service.
  • I don't give any warranty that the server is available or keeps a certain minimum level of performance.
  • Please write me a mail (roland(dot)olbricht(at)gmx(dot)de) if you want be informed about downtimes, need response times guarantees or plan to use the API with more load for more than 30 days.
-- Roland 2012-02-16 20h20 UTC


Thanks for the information. For some background: I am currently writing some software to make custom maps and export them as image, tiles, and other map formats. I'm looking for a good way to include data from OSM and was wondering if the API would work, until I could get my own OSM mirror up. I'm thinking of including this in early versions of the software until I can afford to create my own service to provide OSM data. User:alecdhuse 16:017, 17 February 2012 (UTC)


Public transport

Public_transport

I put here the url of the very handfull tool to check bus lines. --FrViPofm 23:45, 26 February 2010 (UTC)

Link unfortunately no longer works. Mmd (talk) 18:05, 29 June 2014 (UTC)

Something wrong ?

Erreur d'analyse XML : aucun élément trouvé
Emplacement : http://78.46.81.38/api/sketch-line?network=Ginko&ref=32&correspondences=20
Numéro de ligne 1, Colonne 1 :

for line 421941 b a r j s but routes are right :

--FrViPofm 00:17, 4 March 2010 (UTC)

URL is obsolete in the meantime, thus closing this one. Mmd (talk) 16:02, 9 September 2014 (UTC)

Trolleybus routes

Trolleybus lines (route=trolleybus) are not rendered - attempting to sketch them results in "No relation found".

To reproduce: 92 Relation 913880 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 913907 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Stanton 00:17, 15 May 2010 (UTC)

Issue can no longer be reproduced with the example provided, hence closing this issue. Mmd (talk) 16:03, 9 September 2014 (UTC)

Stops tagged as amenity=bus_station

Apparently, if one of the stop members of the relation is tagged as area=yes amenity=bus_station, it is omitted completely. For example: 80 Relation 611446 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 611538 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx)

The first stop (Bonola) is tagged as area=yes amenity=bus_station described above and missing from the sketch. This seems incorrect to me as, to my knowledge, bus_station is the tag to be used for a larger bus terminal where multiple lines stop at dedicated platforms, and representing it with an area is encouraged. Stanton 00:21, 15 May 2010 (UTC)

I've now found a potential workaround: on the way that passes the bus_station, create a node where the bus actually stops and tag it as public_transport=stop_position, name=* and add it to the line relation as role : stop. Do not add the bus_station itself to the relation. This seems to be a clean way of mapping to me, as it represents the actual situation (it even adds some detail by specifying where exactly a particular line stops). Results look OK, the above example now displays correctly. Stanton 18:59, 8 November 2010 (UTC)

Stops messed up in sketch

In some cases incorrect stop names are displayed - names are mixed up or the same stop name is displayed multiple times.

Mild example: 19 Relation 661028 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 661000 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx)

Here just one stop name is wrong: the 11th (from Roserio) is displayed as "Duomo" when in fact it should be "Piazzale Accursio". (Duomo is the last stop.) One-way stops (which are present in only one direction) seem to be particular prone to this error, though I have seen it also on two-way stops. Then again, some routes work fine and I can't make out a difference between those that work and those that don't.

A more extreme one would be: 78 Relation 420649 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 445904 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx)

This one is botched beyond recognition and usability: names are either missing completely, or the same name is repeated over and over multiple times.

And finally: 69 Relation 536964 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 537040 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 536992 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Relation 537008 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx) Stanton 00:29, 15 May 2010 (UTC)

You can try omitting the style "padua" which has been personalized for Padova (I inserted some abbreviations and so on which are good to show a better sketch in the case of Padova - multiple stops along the same street) --Tizianos 22:55, 15 June 2010 (UTC)
The examples I gave now work, maybe something's been updated in the meantime. Anyway, I'm not sure if the Padova style really was the culprit as it should just be stop names and some extra information, but swapping stop names...? I'll keep an eye on it and see if the error's really gone. Stanton 23:33, 15 September 2010 (BST)

Train Station not on the tracks is missing in the output

There is a train station near Milan (Parabiago: Link on OSM ) which, while it is part of the S5 rail route Relation 1016814 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx), it's not displayed in the output of http://78.46.81.38/api/sketch-line?network=SITAM&ref=S5&style=padua (it should be located between Vanzago and Legnano).

Might it be due to the fact that the station is not represented as a node on the rail line, but as a separate building placed near the track?

--Stco 16:46, 28 July 2010 (UTC)

What is tagged as station - the building (area) or a single node? If the building is tagged, then it might be the same issue I reported for bus stations above (which would indicate that stops which are not single nodes are ignored). Stanton 23:36, 15 September 2010 (BST)

Problems with RER D

Hello,

I'm a French contibutor from OSM and this script have many problem with the RER D, a local train line. The official line map is here but the script give this. The problems are :

  • The lisibility is not the best
  • The north branch of the line is losed, but exists : click
  • Two stations : Goussainville and Juvisy isn't in the map, but they have the role stop and are the only stations in closed way, not in a singule node

Can you please resole this errors ?

Sorry for my english, Thank's, --JonathanMM 16:24, 19 February 2011 (UTC)

I'm sorry for the late answer. I often miss the comments here on discussion pages of the wiki. Please contact me also per eMail roland(dot)olbricht(at)gmx(dot)de.
The tool has not been designed to render such really complex lines; my current algorithm is too stupid for such lines. A more sophisticated algorithm will take some time
(expect four to eight weeks) to deleop and implement. In the meanwhile I can offer you only a comparable tool at
http://78.46.81.38/api/draw-line?network=RER&ref=D&font-size=12.0&scale=25.0.
By the way, if you have ideas or suggestions how to render complex lines, you are highly welcome to present them here and send them to me.
-- Roland.olbricht 19:43, 03 March 2011 (UTC)

Problems with opening hours surpassing midnight

Hi,

I've got some problems in rendering correctly the opening hours that run across midnight.

I don't know if I'm doing it wrong, if it's a bug or a missing feature.

My opening_hours tag is equal to "Mo-Th 05:15-24:00; Fr-Sa 05:15-24:00, 00:00-01:00; Su 05:15-24:00".

Ideally, I'd like to see something like "sunday-thursday 05:15-00:00, friday-saturday 05:15-01:00".

I'm very far from it because the result is "monday-wednesday 05:15-24:00, thursday 05:15-24:00, friday 00:00-01:00, 05:15-24:00, saturday 00:00-01:00, 05:15-24:00, sunday 05:15-24:00".

Any idea how to fix it ?

Thanks, --Don-vip 01:54, 31 March 2011 (BST)

Problems with stop order

Hi,

When I add stops to a bus line, they are displayed in the diagram in the order I create them and not their order belong the line (see the problem and the real map).

How can I fix this (without retagging all stops one by one in the right order) ?

Thanks, --Kalon33 11:57, 14 June 2011 (BST)

Editing style files for line diagrams

Hi, I tried in the section "Using style files" to edit padua or wuppertal style files but the "Edit style" text input in the next page is empty: I would like to not erase what already exists in these files. Is it possible to display the existing content? Thanks. Damouns 09:27, 9 August 2011 (BST)

This should be fixed now. -- Roland 23:08, 17 August 2011 (UTC)

Single direction stops with the same name of the terminus

There are issue with the rendering of single direction stops that have the same name of the terminus. These stops are rendered like double direction stops. http://www.overpass-api.de/api/sketch-line?ref=8&network=ATAC&style=italy

The first "Casaletto" is the terminus, and the second is a single direction stop for "Casaletto" terminus, but rendered like a double direction stop. Is there a solution of that issue? --Madeco 17:10, 15 March 2012 (UTC)

More line selection features in the PT Line Diagram Generator

There is a problem when more than one line of he same ID exists in the same network. For example: The Network VBB(Verkehrverbund-Berlin-Brandenburg) have three Tram-Linies with the ID 2.

Verkehrsverbund_Berlin-Brandenburg#Straßenbahnen

But only one appears [3]

A Solution might be if a third parameter(operator) exists, like: (CV = Cottbusverkehr)

http://www.overpass-api.de/api/sketch-line?network=VBB&ref=2&operator=cv&style=wuppertal

I've added the third parameter, so it should now be possible to deal with the same line number multiple times in the same network.
Is the third parameter "operator" like [4]?

Also a nice feature would be if you could use the color of the line if set in the route-relation.

This is already implemented. Could vou give an example where this doesn't work?
Ok, thanks. :) I found the problem. I put the color tag in the route-master relation, like [5]. When I put the tag in every line relation everything works fine. Maybe it is possible to look at the router-master relation, too.

Proposed_features/Public_Transport#Route

Thanks and great work!


Double Rendering Problems

Hi, I've some problems on rendering, using the new schema (placing "stop" (node public_transport=stop_position on the way) immediately followed by "platform" (node public_transport=platform near)) for every stop. It uses both nodes and creates a mess in the image: example --Arlas 22:07, 4 May 2014 (UTC)

Please check this pull request on github https://github.com/drolbr/Overpass-API/pull/126 Mmd (talk) 15:53, 9 September 2014 (UTC)




XAPI compatibility layer

Relations in XAPI compatibility layer

It seems that the XAPI compatibility layer doesn't handle relations in the way the XAPI page describes. Specifically this: "For each matching relation the nodes and ways referenced by that relation are also returned.". It seems Overpass simply returns the relation but not any members. Though from the wording it sounds like it shouldn't include the member-nodes of ways, which seems strange. Rasher 21:09, 4 October 2011 (BST)

Are pipes broken?

http://www.overpass-api.de/api/xapi?*[@meta][highway=motorway|motorway_link][ref=*][bbox=-77.7502441,36.5272948,-74.9926758,38.4965935] gives no results, even though using simply motorway or motorway_link returns many. --NE2 09:59, 23 December 2011 (UTC)

The result is wrong, but for a different reason. The pipe is treated as ordinary character when more than one key=value attribute is present. I'll fix that with the next version. -- Roland 28 Dec 2011


Missing attribute 'version'

When I try to open http://www.overpass-api.de/api/xapi?*[@meta][ref=I 90 Business] in JOSM it tells me that Node 1564593971 has no 'version' attribute. --NE2 03:42, 28 December 2011 (UTC)

Same error message here, none of the "Meta data" samples on the Wiki page seem to work at the moment. --mmd 28 December 2011

See status page. I've screwed up the meta data while doing the version update. I'm sorry for that. I'll plug out the phone next time when I type on the command line :) A planet reimport is in progress but will take until Friday morning -- Roland 28 Dec 2011

Relation query is incomplete

http://overpass.osm.rambler.ru/cgi/xapi?relation[@meta][bbox=-87.6928711,23.9561363,-79.6728516,31.0811655] (all of Florida) doesn't include any of the state road relations (e.g. Relation 380105 (XML, Potlatch2, iD, JOSM, history, analyze, manage, gpx)). --NE2 15:15, 23 January 2012 (UTC)

This was a well known bug in the stable software version running on the Rambler instance. I've updated that software version now, so the bug should be gone now. -- Roland 2012 Jan 29, 09h20 UTC

Escaping in XAPI compatibility layer

Escaping in predicates does not seem to work like in XAPI, for example

http://overpass-api.de/api/xapi_meta?*[maxspeed%3A%5C%5BMo-Fr%3B700-1700%5C%5D%3D%2A]

returns a parse error - see Xapi#Escaping for details. This breaks taginfo. -- Eckhart 00:27, 9 June 2012 (BST)

Parse error can no longer be reproduced, however the query returns an empty result. Mmd (talk) 16:07, 9 September 2014 (UTC)

<bounds> element

As far as I can tell, the Overpass API does not return <bounds> elements in the XML - at least when used with XAPI Compatibility Layer. This is different from other XAPI services, and also differs from .osm files from other sources (OSM API, JOSM). The missing <bounds> caused me a bit of a debugging headache; I "solved" the problem for now by switching to open.mapquest's XAPI service. My queries look like this:

http://www.overpass-api.de/api/xapi?map?bbox=15.728027,52.130791,15.780762,52.163151[@meta]

--Tordanik 02:05, 22 April 2012 (BST)

Just use Overpass API QL instead of XAPI Compatibility layer, it includes the bounds. Mmd (talk) 16:01, 9 September 2014 (UTC)

recurse in bbox query [solved]

The main page states : the map query, to collect all data from a given bounding box:

<union>
  <bbox-query s="51.249" n="51.251" w="7.148" e="7.152"/>
  <recurse type="node-relation" into="rels"/>
  <recurse type="node-way"/>
  <recurse type="way-relation"/>
</union>
<print mode="meta"/>

However, by doing such call I receive incomplete ways (those which have at least one node outside the bbox) So I have added <recurse type="way-node"/> wich helped. But I'm unable to organise my recurse statements to also get relations for wich the way is a member. Is there an order in the recurse statement ? I've read http://www.overpass-api.de/#section.recurse but I might not understand correctly what the "name of a set" is and if that can help me in my quest sletuffe 01:49, 19 December 2011 (UTC)

All this reminds me the mod_rewrite apache page : "OverpassAPI's recurse statements are dammed cool voodoo, but still voodoo", here is how, I manage to get what I wanted, but have no ideas why it works and if that's optimal :

<union>
  <bbox-query s="51.249" n="51.251" w="7.148" e="7.152"/>
  <recurse type="node-relation" into="rels"/>
  <recurse type="node-way"/>
  <recurse type="way-relation"/>
  </union>
  <union>
  <item/>
  <recurse type="way-node"/>
</union>
  <union>
  <item/>
  <recurse type="way-relation"/>
</union>

And this page [6] is a damn cool source of information for overpass api where what you want is not where you expect it to be, but still is in somewhere ! sletuffe 01:31, 22 December 2011 (UTC)

Output Formats

Alternative Output Format?

Hello! Is there an alternative format for data output (e.g. .pbf or .o5m)? --Marqqs 21:11, 21 December 2011 (UTC)

Some ideas are mentioned in this Github ticket. Mmd (talk) 17:55, 29 June 2014 (UTC)


Overpass QL

not-operator?

Is there a not operator? Basstoelpel 21:07, 18 January 2012 (UTC)

Not yet. There are two not operators that may make sense: Negating specific values out of a key, e.g. all elements with key 'oneway' without those with value 'no'. This will come with the next version. The other one would be to negate any clause in a query statement. That's much more difficult and therefore not on the to do list at the moment. -- Roland
How about elements without a key, such as [highway=motorway][NOT[lanes=*]]? --NE2 23:44, 20 January 2012 (UTC)
[highway=motorway][lanes!~"."] should do. Mmd (talk) 17:57, 29 June 2014 (UTC)


Partial Matches on Keys

I'm trying to match on a partial tag to get any nodes/ways with an address in NZ. This gives me anything with a postcode or a street but it seems inefficient:

 <union>
   <query type="node">
     <bbox-query s="-59.0" n="-25.5" w="157.5" e="179.9"/>
     <has-kv k="addr:postcode" />
   </query>
   <query type="node">
     <bbox-query s="-59.0" n="-25.5" w="157.5" e="179.9"/>
     <has-kv k="addr:street" />
   </query>
 </union>
 <print/>


You can search for partial value attributes but can you search for partial key matches? I would like to be able to do something like <has-kv k="addr:*" />

The search for a partial key isn't implemented. If it were implemented with the current database structure, it would be painfully slow. I will do it on the To-Do-List, be it might take some months to extend the database structure.
On the other hand, the above code is not as inefficient as it looks. It may help to write a script like
  echo "<union>"
  for i in addr:postcode addr:street; do
  {
    echo "<query type="node"><bbox-query s="-59.0" n="-25.5" w="157.5" e="179.9"/><has-kv k="$i"/></query>"
  }; done
  echo "</union><print/>"
to generate such a query for multiple addr:* instances. -- Roland 2012-03-12 07h55 UTC


(Partial) key machtes based on regular expressions is available now, see Github Issue 59 for details. Mmd (talk) 15:29, 9 September 2014 (UTC)

Relation members and roles

I can't seem to find a way in any of the language references to only get relation members that have a specific role. Is this possible at the moment? Thanks! --Joshdoe 10:15, 15 March 2012 (UTC)

+1, see also: http://lists.openstreetmap.org/pipermail/talk-de/2013-January/100717.html --Tyr 13:16, 20 January 2013 (UTC)
Restriction to relation member with a specific role is described on the Overpass QL page. Mmd (talk) 18:03, 29 June 2014 (UTC)


Documentation of parameter <area-query ref="XXXXXX"/>

at https://help.openstreetmap.org/questions/15748/extract-statistics-for-a-city I came across the parameter area-query that seems to enable an area defined by a boundary relation to take tha data from, instead of a bounding box.

Where is this (new?) parameter described in detail? or am I blind?

And how does a query look like if I know a place defined by a certain boundary relation (for example with admin_level=8) and I want to get all highways that have the key name= with any value? Thus I want to get a list of all named streets belonging to a place or city with boundaries. --Stephan75 20:49, 5 September 2012 (BST)

Looks like roland is in the process of migrating documentation from a good old flat html file to the osm wiki (I couldn't find this on http://overpass-api.de/ any more) but here you can find a slightly outdated copy : http://api.openstreetmap.fr/ )
With the area-query explained here : http://api.openstreetmap.fr/#section.area_query sletuffe 10:50, 6 September 2012 (BST)


Simple recursion is not returning

The following query runs fine and returns all the nodes less than 50m away from the "Paris" node:

<osm-script>
  <query type="node">
    <has-kv k="place" v="city"/>
    <has-kv k="name" v="Paris"/>
  </query>
  <query type="node">
    <around radius="50"/>
  </query>
  <print/>
</osm-script>

Now I want to find the ways that use these nodes, so I add naively a recurse statement:

<osm-script>
  <query type="node">
    <has-kv k="place" v="city"/>
    <has-kv k="name" v="Paris"/>
  </query>
  <query type="node">
    <around radius="50"/>
  </query>
  <recurse type="way-node"/>
  <print/>
</osm-script>

Unfortunately, that doesn't return (or it's way too slow). What I am doing wrong ? Ocroquette 09:12, 6 December 2012 (UTC)

It must be "node-way" instead of "way-node", because you are going from nodes to ways:
<osm-script>
  <query type="node">
    <has-kv k="place" v="city"/>
    <has-kv k="name" v="Paris"/>
  </query>
  <query type="node">
    <around radius="50"/>
  </query>
  <recurse type="node-way"/>
  <print/>
</osm-script>
--Roland

Of course you are right. It was a copy-paste error. However, your query doesn't return anything: Query on overpass-api.de Ocroquette 10:09, 6 December 2012 (UTC)

The query returns ways only. This makes sense for example if you want to get the streetnames. If you want to display the result, you also need the nodes referred by the ways:
<osm-script>
  <query type="node">
    <has-kv k="place" v="city"/>
    <has-kv k="name" v="Paris"/>
  </query>
  <query type="node">
    <around radius="50"/>
  </query>
  <union>
    <recurse type="node-way"/>
    <recurse type="way-node"/>
  </union>
  <print/>
</osm-script>
--Roland

Thanks, that makes sense. Part of the confusion was due to inconsistencies on the documentation page. Please review my changes.

I have also created a dedicated FAQ. Ocroquette 12:23, 6 December 2012 (UTC)

Overpass Server

Query address for rambler

What is query addres for rambler server? I'm trying to use address from description, but I get error 404... Pbm 14:28, 1 January 2012 (UTC)

Please have a look at http://overpass.osm.rambler.ru/query_form.html. There you can enter a query. Alternatively, you can use http://overpass.osm.rambler.ru/cgi/interpreter resp. http://overpass.osm.rambler.ru/cgi/xapi to directly send queries to. Roland 2012 Jan 3, 20:00 UTC

Server HW

This page lists the main server's hardware as "4 cores, 64 GB RAM" but on its munin stats I rather see something like "8 cores, 32 GB RAM". What's correct? just being curious ;) -- Tyr (talk) 15:38, 14 August 2013 (UTC)

Thank you for the hint, I've corrected the values. I myself also needed to lookup and left the result here. --Roland

Contributed Scripts

I wrote a little proxy/translator for the API 0.6 from the overpass API

The Overpass API allready has a xapi translator, and I wrote one for the API 0.6 :

It does not need to be on the same server as the overpass api one, it can be installed anywhere sletuffe 14:02, 5 February 2012 (UTC)

Query script

Here is a bash script that takes an overpass query written in a .txt file (the first argument) and runs it, writing the results to a filename of your choosing (the second argument).

  • Query.txt
data=
 
[timeout:600];
 
 
(
	node["name"="Bonn"];
	node (around:1000) ["name"="Gielgen"];
);
 
out meta;
  • overpass_query
#!/bin/bash
 
 
	if [[ $# -ne 2 ]]
	then
	echo -en "\n\n\tUsage:  $0 queryFile.txt outputFile.osm\n\n"
	exit
	fi
 
queryFile="$1"
outputFile="$2"
 
echo -en "\n\nrunning query and writing to '$outputFile':\n\n"
cat "$queryFile"
 
time wget --timeout=0 -O "$outputFile" --post-file="$queryFile" "http://overpass-api.de/api/interpreter"
  • To run the script save the two files above into Query.txt and overpass_query respectively and then execute the following command (note you will probably need to give the script execute permission with "chmod +x overpass_query" first).
./overpass_query Query.txt query.osm

Miscellaneous

Query last 20 changsets in a bbox

Osm.org hat the "changes" tab. The "normal" api is slow on that. I would like to query the last 20 changesets of an area, exclude Robots, retrieve all affected nodes, way and relations with one fast query. Is that possible?

How to combine query and area-query for ways

For example how to get all {Key|highway|platform} ways from city Prague (relation 439841) ... well I have found out myself

  <area-query ref="3600439841" />
  <recurse type="node-way" />
  <query type="way">
    <item />
    <has-kv k="highway" v="platform"/>
  </query>
  <print />

cool.


Proper escaping in meta export (print.cc)

In XML, & needs to be escaped as &amp;. Currently, standard conform parsers throw an error, e.g. osm2shp from the Osmium framework, …

terminate called after throwing an instance of 'std::runtime_error'
  what():  XML parsing error at line 308:145: not well-formed (invalid token)
Aborted

… when parsing the following file (only line 308) …

  <node id="683970" lat="48.2531004" lon="16.4216139" version="12" timestamp="2011-07-17T22:10:02Z" changeset="8753170" uid="26818" user="David & Christine Schmitt"/>

-- Simon04 21:34, 8 September 2011 (BST)

Wishlist

Note: Consider creating a Github issue instead: https://github.com/drolbr/Overpass-API/issues

nearest n objects that satisfy predicate to point

One thing that I think the Overpass API could add which would be very useful: the ability to specify some criteria and get back all the objects that match some predicate based on distance to a point. The closest I can find to this at the moment is using Cloudmade's API per the directions here. It'd be great if that kind of thing was supported by Overpass. Tom Morris 21:56, 14 January 2013 (UTC)

Does the around statement fit your needs? An example, another example and the reference. -- Roland
No it doesn't. (I'd like this feature too.) The problem with "Around" is that is requires a limiting radius, whereas we'd like a limiting number N. Imagine trying to find the nearest 3 bus-stops to (a) a point in central London, (b) a point in the middle of the sea. The radius required in each case would be massively different. --Danstowell (talk) 12:46, 2 February 2013 (UTC)

Case-insensitive regex matching

It would be nice if regexes could also be case-insensitive. Most regex libraries allow this, so I'll assume that the one employed by the Overpass API also does. If so, the only question is how to incorporate the feature in the query syntax. I would suggest regvi=// (i for insensitive) to accompany regv=// in XML; maybe an operator ~~ (negated as !~~) in Overpass QL? -- Oli-Wan (talk) 09:19, 7 May 2013 (UTC)

It is already implemented. An example:
node[name~"holtorf",i];out;
and
<has-kv case="ignore" k="name" regv="holtorf"/>
-- Roland
Whoops, sorry. Guess I should make an appointment at the ophthalmologist's :( -- Oli-Wan (talk) 10:18, 7 May 2013 (UTC)