I'm trying to extract all the polygons for the buildings in my country, however, it seems osm2pgsql is extracting very little information compared to what I need.

My idea was that I will rely on the empty.style file and I've set everything to have the "delete" flag, and keep only the tag=[building=yes], importing the building footprints should work. A brief extract from the style file:

# OsmType   Tag                     Type    Flags
# Insert your own columns here, or change polygon,nocolumn to polygon below
node,way    amenity                 text    delete
node,way    building=yes            text    polygon,nocolumn

The problem with this is I am seeing more unwanted polygons (administrative delimitation in Luxembourg) and less of the needed polygons (all the "mapped" buildings footprint polygons).

This is how my file looks like atm: http://pastebin.com/hwtYth22

This is how things look where the tag building=yes, notice the administrative areas polygons making it into the database, but also the lack of all the known polygons:

luxembourg central

If I revert from "building=yes", and I leave it only "building", I get more polygons, but still, not all the buildings, yet more compared to using the "building=yes" tag.

Any advice on what I can do to:

  • prevent the administrative boundaries from showing up in postgres
  • have all the building footprints in postgres so I can filter them out by Office/amenity/etc.

TY, Mark

  • Can you tell me where this map came from? ( geo coordinates ) so I can investigate the elements in OSM website.
    – Magno C
    Commented Jun 29, 2016 at 15:35

2 Answers 2


According to http://taginfo.openstreetmap.org/keys/building#values, the building tag is not limited to yes, but several others. Try to use like default.style :

node,way building text polygon

I don't know why you're using nocolumn.

The administrative boundaries came from ( http://taginfo.openstreetmap.org/keys/admin_level )

node,way admin_level text linear.

Make sure you're not importing it.

Also try to include amenity since it have a combination with building: http://taginfo.openstreetmap.org/keys/amenity#combinations

At last, play a little here before do the import: http://overpass-turbo.eu/

  • Many thanks for your feedback Magno. Wouldn't the amenity tag come with a building tag by default in OSM?
    – Mark Allen
    Commented Jun 29, 2016 at 18:02
  • building can have an amenity value. There is an amenity tag too with its own values. The tags are known by Keyswich become columns in the planet_osm_* tables. So, building=amenity will select just buildings wich have an amenity value ( something like select * from planet_osm_polygon where building = 'amenity' ).
    – Magno C
    Commented Jun 29, 2016 at 19:17

This may be irrelevant, but have you tried imposm 3 or osmosis? They may provide different results.

  • I am extracting the data from PBF to postgres directly. I tried imposm but it halts during the import. Played with osmosis and the filter feature is not as flexible as osm2pgsql. Had to abandon osmosis for that reason. Both osmosis and osm2pgsql give the same results, but osm2pgsql seems to be more practical at "filtering out" the entities from the PBF file, as I am looking at an easy to maintain solution.
    – Mark Allen
    Commented Jun 29, 2016 at 15:31

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.