# How to extract german restaurants from planet.osm?

Want to get the data out of http://wiki.openstreetmap.org/wiki/Planet.osm

UPDATE: i just come back from the site http://wiki.openstreetmap.org/wiki/Planet.osm

which has got some files that belong to the openstreetmap-Project. i downloaded a similar file that is derived from a German Mirrorsite - this one here:

according to this instruction

type bzip2 -d planet.osm.bz2; or your OS may support double-click unpacking. See Wikipedia's list of compression programs.

i did the following - but without success-,

martin@linux-wyee:~/poi_abzug/geofabrik> bzip2 -d germany.osm,bz2;
bzip2: Can't open input file germany.osm,bz2: No such file or directory.


why - can anybody explain why i did not succeed?

end of update;

further questions: Is this a XML-File ?

BTW; i only need the data for the Pois in Germany: can i use this file here - http://ftp5.gwdg.de/pub/misc/openstreetmap/

As this might be of general interest i think that many users can benefit from an answer to this question.

So my question is: How to tread the above mentioned dataset - how to read it - on a OpenSuse-Linux-machine!? Should i do it in the terminal?

Note - i want to store all in a csv file - and i look for all the restaurants... What is the easiest way to do this!?

As i am a newbie - thx for your patience!

-
You certainly don't need Planet.osm if you only want to look for POIs in Germany. Germany.osm listed e.g. in ftp5.gwdg.de/pub/misc/openstreetmap/download.geofabrik.de will be enough. –  underdark Apr 14 '12 at 18:23
hello dear underdark - many many thanks for the answer. Note; i have written an update - see above I am happy that you pointed me to the right source. Unfortunatly i have some issues to open the file in Opensuse 12.1 - i want to inspect the data - and have a closer look . is it possible to have a look at the xml data - eg. the name of the entity - which is the name of a restaurant, then the street and some times even some additional infos. Is it possible to extract those data out of the above mentioned file!? Look forward to hear from you - greetings –  zero Apr 15 '12 at 2:06
Your command did not succeed because the file is named germany.osm.bz2 instead of the germany.osm,bz2 you typed. Only a small difference for your eyes, but a big for the computer ;-) –  AndreJ Aug 13 '13 at 5:21
btw. are you 100% sure that your filename is germany.osm,bz2 usually there is no , in filenames just . (dot) –  simplexio Aug 13 '13 at 11:59

Hope that helps!

Meryloo

-
hello dear maryloo - many many thanks for the answer. Note; i have written an update - see above greetings –  zero Apr 15 '12 at 2:09
can i do some requests on POIs of Openstreetmap with XAPI. doing like so: i send a request to the API-Server - over http as a respond i get the following result - in XML example: the following link gives back all the Nodes of the Type amenity=restaurant in XML-Format. the bounding box (bbox) limits the area: xapi.openstreetmap.org/api/0.6/… what do you say!? –  zero Apr 17 '12 at 22:03

As Underdark noted, you don't need to use planet.osm, but instead use the link she provided contains all data (included restaurants) within Germany.

You'll want to use Osmosis, an OSM data parser. (Check out the detailed usage page to find out more of how to use osmosis, if you're interested.

There may be other ways in osmosis to do it, The following filter should leave you with a file that removes all ways and nodes that DO NOT have the value amenity=restaurant (since Restaurants could be coded in OSM as a node or a way). You have to run 3 commands, as follows:

osmosis --read-xml input.osm --tf accept-nodes amenity=restaurant --write-xml output-nodes.osm

osmosis --read-xml input.osm --tf accept-ways amenity=restaurant --write-xml --used-node output-ways.osm

osmosis --rx output-ways.osm --rx output-nodes.osm --merge --wx merged.osm

As for getting it into a CSV file ? Not sure, but I don't think there's a particular program that directly exports OSM to CSV. Is there a particular reason you want it into a CSV file ? If you're using an application that supports imports of CSV, it might also support other file formats that .OSM data could be exported into.

-
hello dear will - many many thanks for the answer. Note; i have written an update - see above greetings –  zero Apr 15 '12 at 2:09
just looking for the mirror of osmosis pepo for opensuse 12.1 ftp.suse.de/pub/opensuse/repositories/Application:/Geo/… is this the path that i need..? –  zero Apr 15 '12 at 10:21
can i do some requests on POIs of Openstreetmap with XAPI. doing like so: i send a request to the API-Server - over http as a respond i get the following result - in XML example: the following link gives back all the Nodes of the Type amenity=restaurant in XML-Format. the bounding box (bbox) limits the area: xapi.openstreetmap.org/api/0.6/… what do you say!? –  zero Apr 17 '12 at 22:03

Try Overpass, it gives easy access to search POI data from openstreetmap.

Or get the germany.osm data dump and use this link to get the POIs as a CSV file.

(Problems with unzipping a bzip2 file should probably be asked on another stackexchange site)

-

https://github.com/MorbZ/OsmPoisPbf