Maze Posted September 13, 2015 Share Posted September 13, 2015 hi dear community have to perform some big requests to the overpass-api - i want to do this via commandline. cf http://overpass-api.de/command_line.html note: if i do it with the overpass-turbo.eu - api all runs well. [out:csv(::id,::type,"name","website"," contact:email=*")]; area[name="Heidelberg"]->.a; ( node(area.a)[amenity=hospital]; way(area.a)[amenity=hospital]; rel(area.a)[amenity=hospital]; out; output: @id @type name website contact:email=*145970634 node 303300521 node Thoraxklinik http://www.thoraxklinik-heidelberg.de 678470357 node Kurpfalzkrankenhaus http://www.srh.de/de/kk-heidelberg/index.html 1279003446 node Mercy Hospital for Women www.mercyhealth.com.au 1732872588 node GRN-Klinik Weinheim www.grn.de/klinik-weinheim 2343179537 node Klinik für Allgemeine Innere Medizin und Psychosomatik http://www.klinikum.uni-heidelberg.de/Klinik-fuer-Allgemeine-Innere-Medizin-und-Psychosomatik.1088.0.html 3217716361 node kopfklinik 24595717 way Austin Hospital http://www.austin.org.au/ 25208382 way Blutspendezentrale Heidelberg IKTZ 49501406 way Klinik für Kinder- und Jugendpsychiatrie - Tageszentrum für Jugendliche http://www.klinikum.uni-heidelberg.de/Tageszentrum-fuer-Jugendliche.118360.0.html 90355808 way Kliniken Schmieder Heidelberg http://www.kliniken-schmieder.de 91097339 way Salem http://www.krankenhaus-salem.de 96690377 way Unfallchirurgie - Atos http://www.atos.de/klinik/ 99998610 way Warringal Private www.warringalprivate.com.au 140128817 way Institut für Psychosomatische Kooperationsforschung und Familientherapie http://www.klinikum.uni-heidelberg.de/ZPM-Startseite.106894.0.html 141216666 way Tropenmedizinische Ambulanz http://www.klinikum.uni-heidelberg.de/Sektion-Klinische-Tropenmedizin.5489.0.html and so forth well according this document http://overpass-api.de/command_line.html i can do a commandline - request: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.osmwget -O target.osm --post-file=query.osm "http://overpass-api.de/api/interpreter"end of cit. how do i do the command -.... should i do it like so; wget -O target.osm "http://overpass-api.de/api/interpreter?data=node[name=\"Gielgen\"];out;"[out:csv(::id,::type,"name","website"," contact:email=*")];area[name=Heidelberg]->.a;( node(area.a)[amenity=hospital]; way(area.a)[amenity=hospital]; rel(area.a)[amenity=hospital];out; love to hear from you Quote Link to comment Share on other sites More sharing options...
Oha80 Posted December 9, 2022 Share Posted December 9, 2022 I had a similar problem, but I could figured out somehow. In my project I want to get switches around in 1 km of one specific railway stations, in overpass-turbo I run this: node[uic_ref="5516147"]->.allomas;node(around.allomas:1000)[railway~"(switch|railway_crossing)"];out; So with php I get data in xml like this: $xml = simplexml_load_string(file_get_contents('https://overpass-api.de/api/interpreter?data=node[uic_ref="'.$uic_ref.'"]->.allomas;node(around.allomas:1000)[railway~"(switch|railway_crossing)"];out;')); After that I could parse the xml. In my opinion xml is more expedient than csv. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.