Replies: 4 comments 4 replies
-
Osm2pgsql DBs are not designed to be accessed while they are importing. Lua transforms generally only work if the output of the transform depends only on the object and it's parent/children objects. It is technically possible to connect to another postgres DB from Lua, but this would not be connecting through osm2pgsql. |
Beta Was this translation helpful? Give feedback.
-
Maybe there is a different way to think about this… |
Beta Was this translation helpful? Give feedback.
-
Two-stage processing can in theory do what you want:
In practice, you might fail to get the way geometry necessary for the query in the second stage. I don't think there are good functions to access them right now. I also don't know how fast this approach would be. I'd probably rather go for a post-processing script that runs after import/update to osm2pgsql is completely done. The good news is that you can do almost all the post-processing in, say Python:
You don't need to have any quality-index related code in Lua. Just make sure that the flex script imports all the tags needed for the calculation. (If you encapsulate the actual index calculation in the right way in a Python library, you can even use the same code for the QGIS plugin and the osm2pgsql postprocessing. But I'm getting ahead of myself.) Both approaches kind-of work for updates. The catch is that you'd usually would want to update the quality measure of your cycle way when the properties of the parallel road change. To cover that case you would need a trigger that marks surrounding cycleways as 'needs update' when a large road changes. |
Beta Was this translation helpful? Give feedback.
-
Osm2pgsql has a framework for generating generalized data from OSM data. It works by first doing the import and then calling |
Beta Was this translation helpful? Give feedback.
-
We are thinking about how to migrate the proof of concept of the cycling quality index to an osm2pgsql processing.
Here is what the QGIS-Python "proof of concept"-script does…
The result is an index value for the road segment.
This far this could all be done with regular osm2pgsql. BUT, an important information for the infra-category selection is, whether the (cycle)way is parallel to a (car)street. This can be mapped explicitly but seldom is. What @SupaplexOSM does is to probe for highways ever 100 meters and if 2/3 are nearby a (car)highway, attributes of that "parallel" highway are used to change the categorization.
My issue with that is, that in osm2pgsql we cannot switch between "LUA > SQL > back to LUA" (right?).
So ATM I see two options…
a. Osm2pgsql get a magic helper that provides information on parallel highway infrastructure that I can use right in LUA.
b. We need to split the processing and do quite a bit of it in SQL…
I really don't like that we have to move so much logic into SQL in scenario b.
Is there a better way to do this?
Is option a something that might happen?
Beta Was this translation helpful? Give feedback.
All reactions