[Tile-serving] [openstreetmap/osm2pgsql] Getting admin_centre node in process_relation (Discussion #1763)
Martin Ždila
notifications at github.com
Fri Sep 16 12:55:07 UTC 2022
Hello,
I need node with name and geometry (point) in `process_relation` function. My current approach is following:
```lua
local node_table = {};
function osm2pgsql.process_node(object)
if object.tags.place then -- consider only places not to fill-up whole RAM
node_table[object.id] = { point = object:as_point(), name = object.tags.name }
end
end
function osm2pgsql.process_relation(object)
local type = object.tags.type;
for _, member in ipairs(object.members) do
if member.role == 'admin_centre' and member.type == 'n' then
local node = node_table[member.ref]
// now I can use `node.name` and `node.point`
end
end
end
```
Is it correct? I mean it works but it requires storing potential nodes to `node_table` which eats RAM. I would expect to be able to access nodes (and ways) including geometry in `process_relation` via some API but I couldn't find it.
Maybe another approach could be to store references to admin_centre nodes in `select_relation_members` and then look them up in `process_node` to save some memory?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/discussions/1763
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/osm2pgsql/repo-discussions/1763 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220916/c080dd0a/attachment.htm>
More information about the Tile-serving
mailing list