Automatic label point layer from Multipolygon layer using ST_PointOnSurface on the fly #1143
-
Hi everyone, I've got a Multipolygon geom table in Postgres and use Geodjango/Maplibre GL JS to write read in this table. I could trigger a function in postgres to create/delet entry in a separate Point geom table for every create/delete of the Multipolygon table. But i was wondering if there is a more elegant way like creating a composite source from the existing Multipolygon table and a point layer source that would be generated on the fly (no table in Db) with ST_PointOnSurface before rendering the tiles avoiding duplicates labels ? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Maybe function source is what you want? |
Beta Was this translation helpful? Give feedback.
-
Ok SRID was missing CREATE VIEW public.mygeometry_table_label AS It does appear in the catalog, thank you very much ! |
Beta Was this translation helpful? Give feedback.
-
Thank you nyurik and sharkAndshark i was also wondering about speed between view and function, you answer my question before i had time to ask. |
Beta Was this translation helpful? Give feedback.
Postgres function which takes z integer (or zoom integer), x integer, y integer as arguments and return
bytea
will be added as vector tile source.You need to create a database function like this: