I've made a map in which buildings in a city are displayed using shapefiles from Geofabrik and unfortunately, none of the shapes contain the housenumber.

When I download the .osm files from Geofabrik the multipolygon layer is empty, but when I download the OSM Data directly via the OSM download tool in QGIS, the multipolygon layer contains buildings, but only if the area where I download it is very small (roughly 30 buildings at a time).

Is there a way to get the multipolygons from OSM other then downloading 30 buildings at a time, then when those are downloaded, extract the housenumber from the other_tags field in the attribute table?

  • I think you will need to create an extract from OSM Planet ( or other you like ) using osmosis. Try this: wiki.openstreetmap.org/wiki/Key:addr
    – Magno C
    Commented Jun 17, 2016 at 11:05
  • Thank you for all your help, I'm trying to do it via an extract of planet.osm. But this will be very much work for me, so I only can start doing this in a view days/weeks.
    – Riker
    Commented Jun 21, 2016 at 10:15
  • Try it with a smaller import file. wiki.openstreetmap.org/wiki/Export
    – Magno C
    Commented Jun 21, 2016 at 11:30
  • well, the problem is not the time of rendering, its the time i have to invest to understandy which syntax I have to use/create
    – Riker
    Commented Jun 21, 2016 at 13:00
  • or perhaps somebody knows the syntax off the cuff. I Need all buildings within Germany, with "name" and "housenumber" in the attribute table.
    – Riker
    Commented Jun 21, 2016 at 13:06

2 Answers 2


The OpenStreetMap Wiki is your friend: http://wiki.openstreetmap.org/wiki/Map_Features. You can also get a lot of good information from here: https://taginfo.openstreetmap.org/keys/addr:housenumber#combinations.

You may need this:


and this: https://wiki.openstreetmap.org/wiki/Key:addr

This command line was not tested but can show the way:

osmosis --read-xml your_osm_file.osm.bz2 --tag-filter accept-nodes addr:housenumber=*, addr:street=*, other_tags_you_may_need --write-xml roads.osm

Or you can import to PostgreSQL using osm2pgsql: http://wiki.openstreetmap.org/wiki/Osm2pgsql and use a custom style file: https://github.com/openstreetmap/osm2pgsql/blob/master/default.style

Osm2pgsql is simple to use but you must know how to do a good tunning or it will take a century to import your data.

osm2pgsql -C 2500 -c -d database_target_table -U postgre_user -W -s -S ./your_style_file.style your_osm_file.osm

enter image description here

EDIT: Creating a table to make the things easy. This will be necessary when you need to create a Geoserver Layer.

Pros: Will be easy to locate just what you need.

Cons: You will duplicate the data and will be hard to update later (want to use a view?).

In this example I'll create a table route-tunnels from planet_osm_line with all tunnels. You just need to search for your data in addr:housenumber column at planet_osm_line table. Remember: As far as I know, not all streets will have house numbers. I think it will be in planet_osm_polygon table if you import building:* too.

DROP TABLE IF EXISTS "route-tunnels";
CREATE TABLE "route-tunnels" AS ( 
  SELECT way,highway FROM planet_osm_line 
  WHERE highway IN
  ( 'motorway', 'motorway_link', 'trunk', 'trunk_link', 
    'primary', 'primary_link', 'secondary', 'secondary_link',
    'tertiary', 'tertiary_link', 'residential', 'unclassified' )
  AND tunnel IN ( 'yes', 'true', '1' )
ORDER BY z_order );
CREATE INDEX "route-tunnels_way_idx" ON "route-tunnels" USING gist (way);

enter image description here https://taginfo.openstreetmap.org/keys/building#combinations

  • thanks so far, I now installed osmosis, it works. But I can't find a guide, how to extract the house number. I can (with your command line) extract the buildings which do have a housenumber, but I do need a file with all buildings and a attribute "housenumber" where the housenumber ist stored, if there is one.
    – Riker
    Commented Jun 17, 2016 at 14:30
  • I've made a test importing all Key:Addr tags. AFAIK you can't rely all data will contain the house numbers. You must import the osmosis result to PostgreSQL or by using osm2pgsql. In this case osmosis will act as a pre filter. I like to go hard and don't use osmosis. I create a custom style file with all tags I want and do the import. So far you will need to create a table with your data (see my edit) by filtering planet_osm_line table.
    – Magno C
    Commented Jun 17, 2016 at 23:52
  • But.... I'm afraid you can find the house numbers in planet_osm_polygon table because of the image above. It came from the OSM wiki and show house numbers to buildings and the buildings are in planet_osm_polygon because they are areas (polygons). You will need to test it or wait some other user confirm it here ( @Iant ? ). Don't forget to import building:* too.
    – Magno C
    Commented Jun 18, 2016 at 0:12
  • 3
    Keep in mind that housenumbers can be placed as single nodes inside the building polygons as well. So you have to look into planet_osm_point as well to get all available numbers.
    – AndreJ
    Commented Jun 18, 2016 at 5:29
  • @AndreJ agree. See the distribution percents here: taginfo.openstreetmap.org/keys/addr%3Ahousenumber
    – Magno C
    Commented Jun 19, 2016 at 20:04

Apart from using the full planet, you can download extracts in osm.pbf format from Geofabrik for certain regions. They contain all data within the region, while the shapefiles only contain some most-wanted topics.

You can load the data into a Postgis database with osm2pgsql, or in a spatialite database with ogr2ogr.

For use in QGIS, you can also try the QuickOSM plugin, which lets you download filtered topics from the OSM database inside the current view.

Keep in mind that housenumbers do not have to be tagged on a building, but sometimes only on a single node for the the entrance, or a shop (or several) that is inside the building.

In some cases, a building on a street corner may have different housenumbers for the entrances on the joining streets. These housenumbers can not be put on the building polygon in an easy way.

  • I've made some imports using osm2pgsql and play a little with the style file but I was unable to have much more house numbers. All I've got was some churches and commercial buildings and a few commom people houses. Can you show some tag combination to use as style file to get all possible house numbers?
    – Magno C
    Commented Jun 19, 2016 at 20:14
  • 1
    The addr:housenumber tag is good enough, without a need to look for combinations. I usually take the centroid of the polygons, and add those to the planet_osm_point numbers in a new table. The other way round is much more complicated.
    – AndreJ
    Commented Jun 20, 2016 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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