I'm working on a project where I have to get all the streets of the city where I live, including colony, suburb, postal code, but I am a little confused about what process do I have to follow.

I have download three files from geofabrik.de (osm.pbf, osm.bz2 and shp) that belongs to my country Mexico.

I have other shapefiles of my city (I opened them in the site https://mapshaper.org/ and only could see the boundaries of my city).

So I would like to know how can I extract the full address including the street, postal code, etc.

I work with Windows.

This is what I have done without results (in my point of view)

I load country.osm.pbf file to OSGeo4w QGIS3 (I am able to see the map), but I do not know how to export the data that I need. I click on the layers and export to csv, but the generated files are to big and includes a lot of points and information that I do not need.

I also use osm2mssql tool to migrate country.osm.pbf to SQL Server but the generated database contains some points but not all the streets.

I also used osmconvert to transform the pbf file to o5m

Then I run this

.\osmfilter.exe mexico.o5m  --keep="addr:country= and addr:city= and addr:postcode= and addr:street= and addr:state="  --ignore-dependencies | .\osmconvert64-0.8.8p.exe - --csv="@oname @id @lon @lat addr:country addr:city addr:postcode addr:street addr:state" --csv-headline -o=filteredfile.csv

But it only generates about 1000 rows.

I do not know if the geofabrik files includes all the streets of my country or only some points about malls, banks and something like that.

  • Is it intentional that addr:housenumber is omitted? Shouldn't be the cause for the missing addresses, though. IIRC Geofabrik omits information in its shapefiles but not in other files, not sure about this though. If you have doubts then try one of the other OSM extracts. Maybe switching from osmfilter/osmconvert to osmium-tool could also help. However there are no official osmium-tool binaries for Windows available. – scai Jun 24 at 6:23
  • Using a DB is the way to go, make sure the information of interest is not filtered out in the config file. – JGH Jun 24 at 11:27
  • 1
    For the OSMFILTER, you may want to select when any of the address element is populated, not necessarily all of them. It is common to see the state/province null because it can easily be spatially retrieved. (I have seen people doing large edits just to remove this information!) – JGH Jun 24 at 11:30
  • Thank you very much for your help I think I will try other OSM extracts because I reduce my pbf with a polygon and filter again with osmfilter but even if I filter only the streets they are not complete :(. – Daniel ML Jun 24 at 20:02

Your Answer

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

Browse other questions tagged or ask your own question.