3

Site http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema describe OSM/pgsql database schema. But I don't understand the meaning of z_order in this model.

3

2 Answers 2

2

z_order is a field in osm2pgsql datamodel that map OSM Layers in OSM tags to a number in osm2pgsql model.

Links:

Osm2pgsql tables

OpenStreetMap Layer

1

OpenStreetMap data does not include z_order as a tag. The z_order artificial tag is computed by using logical rules when OSM data is prepared for rendering. How osm2pgsql program does this is explained in https://wiki.openstreetmap.org/wiki/Osm2pgsql

z_order Adds a column that is used for ordering objects in the render. It mostly applies to objects with highway=* or railway=*. Use with int4 as the data type.

The tags and corresponding z_values are defined in the style file. See https://github.com/openstreetmap/osm2pgsql/blob/932ded7f191bad5994b67ff60038ffe211d00efe/style.lua which is setting z_value to -10 for tunnels and to +10 for bridges

-- Array used to specify z_order per key/value combination.
-- Each element has the form {key, value, z_order, is_road}.
-- If is_road=1, the object will be added to planet_osm_roads.
zordering_tags = {{ 'railway', nil, 5, 1}, { 'boundary', 'administrative', 0, 1},
    { 'bridge', 'yes', 10, 0 }, { 'bridge', 'true', 10, 0 }, { 'bridge', 1, 10, 0 },
    { 'tunnel', 'yes', -10, 0}, { 'tunnel', 'true', -10, 0}, { 'tunnel', 1, -10, 0},
    { 'highway', 'minor', 3, 0}, { 'highway', 'road', 3, 0 }, { 'highway', 'unclassified', 3, 0 },
    { 'highway', 'residential', 3, 0 }, { 'highway', 'tertiary_link', 4, 0}, { 'highway', 'tertiary', 4, 0},
    { 'highway', 'secondary_link', 6, 1}, { 'highway', 'secondary', 6, 1},
    { 'highway', 'primary_link', 7, 1}, { 'highway', 'primary', 7, 1},
    { 'highway', 'trunk_link', 8, 1}, { 'highway', 'trunk', 8, 1},
{ 'highway', 'motorway_link', 9, 1}, { 'highway', 'motorway', 9, 1},

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.