Read cities and streets into a database without ap

2019-06-10 06:25发布

问题:

I managed to download and extract an osm-file into a mysql-database, like:

osmosis --read-xml myfile.osm --write-apidb dbType="mysql" host="localhost" database="osm" user="osm"

What I now need is a way to get only cities and their streets into the database and query them. So how do I limit the data passed from the osm-file to the database to cities and streets? I don't need any additional data.

I do not want to use any only APIs or services.

回答1:

Osmosis supports so-called data manipulation tasks which can be used to filter for specific data. In order to get only cities and streets it should be sufficient to filter for both the place and highway tags (nodes as well as areas). The required parameters seem to be --tf accept-ways place=* --tf accept-nodes place=* --tf accept-ways highway=* --tf accept-nodes highway=* but I never used osmosis myself.