[Tile-serving] [osm2pgsql-dev/osm2pgsql] as_linestring() and likely other geometry transform functions can only be called from the process_way() function, not custom functions. (Issue #2171)
mboeringa
notifications at github.com
Wed Apr 10 12:42:56 UTC 2024
<!-- Please don't use screenshots. Copy and paste the *text* output here if that's needed for context. -->
## 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
<!-- How much RAM do you have, how many CPUs, bare metal or cloud setup? -->
## What did you do exactly?
I have been trying to convert an existing style (a derivative of Paul Norman's work for the flex style of OpenStreetMap carto: https://github.com/gravitystorm/openstreetmap-carto/pull/4431) that still used the now deprecated 'add_row()' function to use the new 'insert()'.
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.
## What did happen instead?
<!-- Please describe what happened and why you think this is wrong. Please include
(or link to, if it is too verbose) the log output. -->
## What did you do to try analyzing the problem?
<!-- Describe what steps you already did to try analyzing the problem before
reporting. -->
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/issues/2171
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/issues/2171 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20240410/0a7c209e/attachment.htm>
More information about the Tile-serving
mailing list