I'm trying to import the address data of a specific country from an OSM file into a MySQL DB.

I tried to insert the data with osmosis and also to filter them with osmfilter before running OSM but without success.

After a long time of google search and frustration, I decided to post here my problem.

Can someone tell me how I can use the osmosis to import only data with following keys ->

'addr:city', 'addr:housenumber', 'addr:postcode', 'addr:street', 'addr:country', 'addr:housename', 'address',  'addr:place', 'addr:suburb', 'addr:province', 'addr:state', 'addr:number'
  • So the mysql part works, but the filtering is not effective, in that you get more data than you want? – BradHards Jul 8 '16 at 6:25
  • Hey Billy, were you ever successfull at this? – Jan Jul 18 '16 at 17:45

As stated here link to previous article while it is possible to add the data to MySQL common wisdom advises against this practice. Most of the tools have been developed to import OSM data in PostgresQL + PostGIS databases, for RDBMS or using GDAL toolkit, to convert OSM XML data to SpatiaLite file database.

| improve this answer | |
  • 1
    that is not the problem. For MySQL exists already some tools like osmosis. my question is how can i extract only street data with help of osmosis or osmfilter? – Billy Sanders Jan 13 '16 at 14:52

Osmosis has option for tag filter. here is the documentation. https://wiki.openstreetmap.org/wiki/Osmosis/Detailed_Usage_0.46#--tag-filter_.28--tf.29

Example usage:
osmosis \
  --read-xml input.osm \
  --tf accept-ways 'addr:city'=* \ 
  --tf accept-ways 'addr:housenumber'=* \
  --tf accept-ways 'addr:number'=* \
  --used-node \
  --write-xml output.osm
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.