[OSM-dev] osm2pgsql: meaning of z_order column in polygon and point tables

Sven Geggus lists at fuchsschwanzdomain.de
Fri Jul 17 09:06:59 UTC 2015


I'm currently investigating the capabilities of imposm3 as a drop-in
replacement for osm2pgsql.

The Generation of the z_order column seems to be the only showstopper which
is left to make an imposm3 generated databases suitable for rendering tiles
with the osm standard style.

Unfortunately I have a problem of understanding the generation of the
z_order column for polygon and point tables.

While it seems to be always empty on the point layer and unused in
carto style it seems to be used in the case of polygons.

Looking at the "add_z_order" function it seems to mostly make sense on roads
only, but it is called in the generation of polygon layers anyway.

My small handcrafted .osm testfile did always add zero to this column which
I nearly expected, as the add_z_order function seems to be mosytly made for

Am I right in the assumption, that z_order on polygons is only a matter of
the layer tag and could thus be easily emulated using a simple database view
which evaluates tags->'layer' in a hstore column?

Looking at my database seems to confirm this suspicion, but there are also
some occasional apperances of z_order=3 and z_order=5 which seem to be
created mostly unintentially? 

An area tagged railway=station is getting added 5 to the z_order column
only because it is assumed to be a linestring rather than an area?

Same goes for highway areas which are getting added 3 to the z_order column
only because it is assumed to be a linestring rather than an area?

Would be nice if someone could shed a ligth on this.



Exploits and holes are a now a necessary protection against large
corporate interests. (Alan Cox)

/me is giggls at ircnet, http://sven.gegg.us/ on the Web

More information about the dev mailing list