[Tile-serving] [openstreetmap/osm2pgsql] Add option to how flex output handles ids in output tables (#1299)

Jochen Topf notifications at github.com
Wed Oct 21 13:37:26 UTC 2020


Osm2pgsql needs to keep track of all objects it writes into the output
tables by their id, so it can remove/update them when the database is
updated. In the flex output there were two options:

* Use tables with nodes, ways, or relations only. Then we can write
  the id of those objects "as is" into those tables.
* For area tables, ways can use positive ids and relations negative
  ids.
* For tables which can take more than one type of object, we use
  two columns, one for the object type ("N", "W", or "R"), one for
  the id.

The second option has the drawback that we need to have two columns
which might take more space and also makes some operations more
difficult. Some programs might also need a single unique id column.
So we added a new option here: Just have a single id column and,
similarly to how this is done for area tables, convert the ids.

Rather then inventing a new scheme, we use the same scheme that imposm
uses in this case: node ids stay the same (so they are positive), way
ids are negative and relation ids are negative and 1e17 is subtracted
from them. This gives distinct ranges for all ids.

To tell osm2pgsql that you want the type scheme, do not set the
"type_column" option on the ids setting in your flex Lua config.
(Before this, not setting this option meant you get the default
column name "osm_type".)
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/osm2pgsql/pull/1299

-- Commit Summary --

  * Add option to how flex output handles ids in output tables

-- File Changes --

    M src/flex-table.cpp (4)
    M src/flex-table.hpp (15)
    M src/output-flex.cpp (13)
    M tests/data/test_output_flex_uni.lua (44)
    M tests/test-output-flex-uni.cpp (161)

-- Patch Links --

https://github.com/openstreetmap/osm2pgsql/pull/1299.patch
https://github.com/openstreetmap/osm2pgsql/pull/1299.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1299
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201021/d91b2aa3/attachment.htm>


More information about the Tile-serving mailing list