-
Posts
184 -
Joined
-
Last visited
Everything posted by Maze
-
hello dear community, i run a request against overpass-turbo.eu see http://overpass-turbo.eu/s/bsU [out:csv(::id,::type,"name","website"," contact:email=*")]; area[name="Thüringen"]->.a; ( node(area.a)[amenity=kindergarten]; way(area.a)[amenity=kindergarten]; rel(area.a)[amenity=kindergarten]; out; as a result i get the following i want to store this into db - or at least into calc doable - i guess yes: calc seems to be pretty easy. but mysql?
-
hello dear Barand many many thanks - great !! You have helped me alot!
-
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: 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.osm wget -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
-
hello - i ve gained some more ideas. What i ve done so far?! I tried to extract some data from an .Osm File. -.-you can run a demo-command here at overpass turbo i want to store the data in a database - (or at least in an excel-file) So I have - within an amount of xml-data - something like this: "tags": { "addr:city": "Barcelona", "addr:housenumber": "1", "addr:postcode": "08022", "addr:street": "Carrer de Torras i Pujalt", "amenity": "hospital", "contact:email": "[email protected]", "contact:fax": "+34 932124050", "contact:phone": "+34 932122300", "contact:website": "http://csf.com.es/", "name": "Cliníca Sagrada Família" } So, the question is this: how can store all those values I tried to make some kind of foreach without sucess. And definitely I don't know why is suposse we have one Iteration that get all the values and why is not possible to store together. Well i heard about that we can use SimpleXMLElement::xpath here to get all the values and the corresponding values. For example : $raw = <<<EOF <root> { "type": "node", "id": 583257940, "lat": 41.4134446, "lon": 2.1426945, "tags": { "amenity": "hospital", "emergency": "yes", "name": "Clinica Delfos" } }, { "type": "node", "id": 618312181, "lat": 41.4138593, "lon": 2.1970778, "tags": { "addr:city": "Barcelona", "addr:housenumber": "211", "addr:postcode": "08020", "addr:street": "Carrer de Fluvià", "amenity": "hospital", "health_facility:type": "health_centre", "medical_system:western": "yes", "name": "CAP Sant Martí", "phone": "+93 307 07 66" } }, { "type": "node", "id": 876348001, "lat": 41.3841883, "lon": 2.1952253, "tags": { "amenity": "hospital", "emergency": "yes", "name": "Hospital del Mar", "website": "http://www.parcdesalutmar.cat/hospitals/hospital-del-mar/index.html", "wheelchair": "yes" } }, </root> EOF; $xml = simplexml_load_string($raw); foreach($xml->xpath("//way") AS $way){ $via = $way->xpath("tag[@k='name']/@v")[0]; foreach($way->nd AS $nd){ $idnode = $nd["ref"]; echo $idnode .", ". $via ."<br>"; } } question: how to use SimpleXMLElement::xpath here? btw - you can run a demo-command here at overpass turbo /* This has been generated by the overpass-turbo wizard. The original search was: “hospital in rome” */ [out:json][timeout:25]; // fetch area “” to search in {{geocodeArea:rome}}->.searchArea; // gather results ( // query part for:rome “hospital” node["amenity"="hospital"](area.searchArea); way["amenity"="hospital"](area.searchArea); relation["amenity"="hospital"](area.searchArea); ); // print results out body; >; out skel qt; then you get lots of results.... question: how to store those results in either excel or mysql? love to hear from you best matze btw: can have something to do with the following: well to create the db is no problem at all - but to put (port over the xml) seems to be a bit tricky. i have managed to get the easier part - eg the following_ create a db-connect: ?php mysql_connect("mydb","user","passwd") or die ("no connecting possible");; mysql_select_db("name of the db") or die ("the db does not exist.");; mysql_query("SET NAMES 'utf8'"); ?>last line is necessary for ensuring that the UTF8-coded data are transferred correctly and subsequently another part - see the file for the request
-
hello dear all ` the db or the excel-sheet has got the following categories -.... "version": 0.6, "generator": "Overpass API", "osm3s": { "timestamp_osm_base": "2015-09-12T20:05:02Z", "timestamp_areas_base": "2015-09-11T13:16:03Z", "copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL." }, "elements": [ { "type": "node", "id": 248528643, "lat": 41.9216283, "lon": 12.5403769, "tags": { "amenity": "hospital", "emergency": "yes", "name": "Pronto Soccorso" } }, { "type": "node", "id": 262114028, "lat": 41.8282625, "lon": 12.4184520, "tags": { "addr:city": "Roma", "addr:housenumber": "13", "addr:postcode": "00148", "addr:street": "Via Luigi Ercole Morselli", "amenity": "hospital", "name": "Ospedale San Giovanni Battista", "operator": "Associazione dei Cavalieri Italiani del Sovrano Ordine di Malta", "ref:vatin": "IT00995661006", "website": "http://www.ordinedimaltaitalia.org/acismom-attivita-sanitaria" } }, { "type": "node", "id": 301593099, "lat": 41.8747002, "lon": 12.4562978, "tags": { "amenity": "hospital", "name": "Clinica Città di Roma", "source": "PCN" } }, { "type": "node", "id": 365299638, "lat": 41.8357070, "lon": 12.4284693, "tags": { "amenity": "hospital", "created_by": "Potlatch 0.10f", "name": "Ospedale Israelitico" } }, { "type": "node", "id": 428571538, "lat": 41.8503399, "lon": 12.4208258, "tags": { "amenity": "hospital", "name": "Villa Sandra", "wheelchair": "yes" } }, { "type": "node", "id": 434692525, "lat": 41.8870757, "lon": 12.3983943, "tags": { "amenity": "hospital", "emergency": "yes", "name": "Aurelia Hospital", "url": "http://www.aureliahospital.com/", "wheelchair": "yes" } }, { "type": "node", "id": 677112577, "lat": 41.8663812, "lon": 12.4573888, "tags": { "addr:city": "Roma", "addr:housenumber": "292", "addr:street": "Via Portuense", "amenity": "hospital", "name": "I.N.M.I. L. Spallanzani", "website": "http://www.inmi.it/" } }, { "type": "node", "id": 677114577, "lat": 41.8689538, "lon": 12.4560799, "tags": { "amenity": "hospital", "name": "San Camillo", "website": "www.scamilloforlanini.rm.it/" } }, { i want to store all the results in a a. excel-sheet or b. mysql-db note: the db or the excel-sheet has got the following categories -.... "addr:city": "Madrid", "addr:housename": "Centro de Salud Cceres", "addr:housenumber": "4", "addrostcode": "28045", "addr:street": "Calle de Cceres", "amenity": "hospital", "name": "Centro de Salud Cceres" how to achieve that
-
dear community, how to extract this dataset? they are results that i get from a request at http://www.overpass-turbo.eu a request on the openstreetmap-files: the db or the excel-sheet has got the following categories -.... "tags": { "addr:city": "Madrid", "addr:housename": "Centro de Salud Cceres", "addr:housenumber": "4", "addrostcode": "28045", "addr:street": "Calle de Cceres", "amenity": "hospital", "name": "Centro de Salud Cceres"
-
hello dear phpfreaks if i copy the directory home/my_name from hdd to external drive - with dolphin i get a loss of data rangning form 10 to 15 GB - in other words up to 15 percent questions : a- is it more appropiate to do this job with commaandline? b- where does this loss of data come from c- can i make sure that i have no loss - with any version / method - i would prefer to go the command line way