1

So I am using a PostgreSQL database with the PostGIS extension to extract building data with addresses from osm data.

I just discovered that in my dataset, imported with osm2pgsql of the german city hamburg there are some entries in planet_osm_line which have addresses. Those entries are also valid polygons, i tried to transform those LINESTRINGs with ST_MakePolygon and that worked for every entry.

Here is an example of what I am talking about: Not rendered building.

So I wondered why osm2pgsql did not interpret them as polygons. To my understanding a valid polygon (closed way) needs identical start and end nodes, which is so far true for every entry.

I might be missing something here, so can anyone with more experience can explain this to me?

Here is the text representation of the geometry from above: enter image description here

  • Is it some building with an interior open area or something like that? – Swarley Sep 14 '18 at 15:53
1

welcome to StackExchange GIS!

It looks like the difference is the tagging of the buildings. Way 171640616 is building:demolished=yes whereas way 171640812 is just building=yes.

If you look at the default style for osm2pgsql, the default settings for building as a tag are to create a polygon (see the OSM Wiki for further details on how this works), but in the first case this tag does not exist, so the addr:housenumber entry is dominant, which is set to linear, which explains the geometry you are getting.

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.