[GIS] osm2pgsql: Extracting full buildings polygons + addresses text from OSM

openstreetmaposm2pgsql

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

Best Answer

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/