[Tile-serving] [openstreetmap/osm2pgsql] Lua relation members gets post-way transform member tags (#659)
Sarah Hoffmann
notifications at github.com
Fri Dec 23 22:04:03 UTC 2016
There is a comment in the code [here](https://github.com/openstreetmap/osm2pgsql/blob/master/output-pgsql.cpp#L423-L427) confirming that the filtering is intentional. It was introduced in 2565bf738fe69b18443971c40fe4a142163a3714 and the reasoning there is consistent with the old C implementation.
The easy way to work around your problem is to add a fixed tag to filtered ways and check for that, i.e. like that:
```
function wood_ways(tags, num_keys)
if tags["natural"] == wood then
return 0, { name = tags["name"] } , 1, 0
end
return 1, { notwood = "" }, 0, 0
end
function wood_rel_members (tags, member_tags, member_roles, membercount)
if new-style MP then
-- do stuff
else
local iswood = false
for i = 1,membercount do
if member_tags["notwood"] == nil then
iswood = true
break
end
end
if iswood then
-- do more stuff
end
end
```
Sidenote: this hack exploits the fact that we always unpack four return arguments for the function, even when the element is filtered. It might be a good idea for efficiency to reconsider that and not return tags when the element is marked as filtered.
While I don't think that the current behaviour is a bug (it serves the limited use-case of old-style MP filtering as done in the C transform well enough), I would agree that it is far from ideal. I'd be tempted to move the filtering into the LUA functions/C transform, so that it is left to the user to decide if the second filter step is even necessary. However, I don't know how many people rely on the current behaviour.
--
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/659#issuecomment-269050428
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20161223/6737437d/attachment.html>
More information about the Tile-serving
mailing list