-
-
Notifications
You must be signed in to change notification settings - Fork 479
Description
What version of osm2pgsql are you using?
osm2pgsql version 1.11.0 (1.8.1-397-gcf66989f)
What operating system and PostgreSQL/PostGIS version are you using?
Ubuntu 22.04
PostgreSQL 16.2 (Ubuntu 16.2-1.pgdg22.04+1), PostGIS 3.4
Tell us something about your system
What did you do exactly?
I have been trying to convert an existing style that still used the now deprecated 'add_row()' function to use the new 'insert()' function (the style is a derivative of Paul Norman's work for the flex style of OpenStreetMap carto: openstreetmap-carto/openstreetmap-carto#4431 and more specifically https://github.com/gravitystorm/openstreetmap-carto/blob/c7066c8a0b670fbd19532241f912c13f55eef215/openstreetmap-carto.lua).
Although I think I have the syntax right now, I run into an issue with a check that osm2pgsql seems to do, I get an error message:
ERROR: Failed to execute Lua function 'osm2pgsql.process_relation': osm2pgsql/flex-config/openstreetmap-carto.lua:1228: Error in 'as_linestring': The function as_linestring() can only be called from the process_way() function.
It is true that Paul's work for that style uses a couple of helper functions which implement the actual insertion 'add_row/insert', and that the 'as_linestring()' function call thus is not inside the 'process_way' function.
While I could theoretically rewrite everything to be inside the 'process_way' function, this not only would bloat the function, but this limitation also hampers general Lua development.
It also kind of breaks "backward compatibility" with the deprecated 'add_row' function, as using that function in a helper function outside 'process_way' was never a problem and simply worked.
Could this limitation with 'insert' and required 'as_linestring/multipolygon' etc. be lifted and allow more flexible function and code design?
What did you expect to happen?
Geometry transforms for the new 'insert' work outside the 'process_way' function.