[Tile-serving] [openstreetmap/osm2pgsql] Lua relation members gets post-way transform member tags (#659)
Paul Norman
notifications at github.com
Thu Dec 22 00:06:54 UTC 2016
My inclination is that this is a bug. I can probably work around it in ClearTables by encoding all the tags into one column as text, since I have a function to do that
```lua
--- Turns a lua table into a PostgreSQL hstore
-- @param table table to convert
-- @return table in hstore string format
function hstore (table)
if table ~= nil then
local s = ''
for k,v in pairs(table) do
s = s..',"'..string.gsub(string.gsub(k,'\\','\\\\'),'"', '\\"')..'"=>"'..string.gsub(string.gsub(v,'\\','\\\\'),'"', '\\"')..'"'
end
return string.sub(s, 2) -- clean up first ,
end
end
function wood_ways(tags, num_keys)
if tags["natural"] == wood then
local cols = {}
cols.name = tags["name"]
cols.original_tags = hstore(tags)
return 0, cols, 1, 0
end
return 1, {original_tags = hstore(tags)}, 0, 0
end
```
I'll then have the call ``wood_rel_members({type="multipolygon"}, {{original_tags='"natural"=>"wood"'}, {}}, {"",""}, 2)``, which contains the information required. But this feels like an ugly hack.
--
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-268680140
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20161221/237b9ffe/attachment-0001.html>
More information about the Tile-serving
mailing list