[Tile-serving] [openstreetmap/osm2pgsql] Feature request: deletion of relation members (#1325)
Kevin B Kenny
notifications at github.com
Thu Nov 19 16:24:00 UTC 2020
At last, I figured out what was going on. I think this is 'just' a documentation problem.
When I defined the table with,
```lua
shieldway_tbl = osm2pgsql.define_table{
name = prefix .. '_shieldway',
ids = { type = 'way', id_column = 'wayid' },
columns = {
{ column = 'relid', type = 'int8' },
{ column = 'idx', type = 'int4' },
{ column = 'role', type = 'text'},
}
```
it did _not_ get cleaned up properly. Replacing that definition with
```lua
shieldway_tbl = osm2pgsql.define_way_table(
prefix .. '_shieldway', {
{ column = 'relation_id', type = 'int8' },
{ column = 'idx', type = 'int4' },
{ column = 'role', type = 'text'},
}
)
```
did get a proper cleanup without needing to jump through hoops. (All of the 'thinking too much' was the result of trying to make the first definition work!)
The reason for using `define_table` in the first place was that I'd read in the documentation:
| If you are using the `osm2pgsql.define_(node|way|relation|area)_table()` convenience functions, `osm2pgsql` will automatically create an id column named `(node|way|relation|area)_id`, respectively. If you want more control over the id column(s), use the `osm2pgsql.define_table()` function.
I'd had existing code that used the names 'wayid' and 'relid' for the columns, because I had tables of a similar structure before trying to switch to the `flex` back end. I was trying to keep the names to keep the code and database changes as minimal as possible. That line in the documentation is what led me astray. If the cleanup is not supposed to work with the `define_table` alternative, the documentation ought to be clarified. (Otherwise, there's still a bug very like what I described, but you need `define_table` to trigger it.)
Anyway, I'm making forward progress again - and now I have some simple, controlled test cases for 'create a relation', 'change relation tags', 'add a way to a relation', 'remove a way from a relation', 'modify a way within a relation', 'delete a relation' which will be the foundation of a unit test suite, so this exercise wasn't entirely in vain.
--
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/issues/1325#issuecomment-730485852
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201119/783228f8/attachment.htm>
More information about the Tile-serving
mailing list