We offer process_node and process_untagged_node functions because calling into lua for every untagged node is expensive. This works well, but some work with two stage processing revealed a weakness.
I want to do second stage processing on all nodes that are members of relations that meet some criteria. I can easily identify them with select_relation_members, the problem is I don't know if they're tagged.
According to the docs I need to do something like this in both process_node and process_untagged_node
if osm2pgsql.stage == 1 then
return
end
if (some logic) then
savedgeom[object.id] = object:as_point()
end
and then access savedgeom during stage 2 relation processing.
This will run fine for stage two processing of tagged and untagged nodes because there aren't that many flagged by select_relation_members. It also work okay for stage one processing of tagged nodes because it's not doing much more work than normal. The problem is stage one processing of untagged nodes.
By simply defining the function and having an if statement for every untagged node it adds work to be done for each untagged node. It isn't much work, but because there are so many untagged nodes in stage one it adds a good chunk of time.
I can't think of a good way to handle this. My specific case is also addressed by #2406, but in general tagging nodes for stage two processing is going to require doing some stage one work on every untagged node.
We offer
process_nodeandprocess_untagged_nodefunctions because calling into lua for every untagged node is expensive. This works well, but some work with two stage processing revealed a weakness.I want to do second stage processing on all nodes that are members of relations that meet some criteria. I can easily identify them with
select_relation_members, the problem is I don't know if they're tagged.According to the docs I need to do something like this in both
process_nodeandprocess_untagged_nodeand then access savedgeom during stage 2 relation processing.
This will run fine for stage two processing of tagged and untagged nodes because there aren't that many flagged by select_relation_members. It also work okay for stage one processing of tagged nodes because it's not doing much more work than normal. The problem is stage one processing of untagged nodes.
By simply defining the function and having an if statement for every untagged node it adds work to be done for each untagged node. It isn't much work, but because there are so many untagged nodes in stage one it adds a good chunk of time.
I can't think of a good way to handle this. My specific case is also addressed by #2406, but in general tagging nodes for stage two processing is going to require doing some stage one work on every untagged node.