[Tile-serving] [openstreetmap/osm2pgsql] Centroid of linestrings (Issue #1771)
Fabian Freund
notifications at github.com
Thu Sep 22 15:32:49 UTC 2022
Sorry for my bad explanation yesterday. I was rethinking today, and maybe I can give you a complete picture.
The spatial function set of this library is very limited, compared to PostGIS. This is completely fine, as this library has another use case. However, it trapped me in thinking I can replace this library now with PostGIS... After further investigations today, I also need to use PostGIS's `ST_PointOnSurface` (when the centroid is outside the surface) and `ST_LineInterpolatePoint` (to get the "middle" of a linestring). So this usage is far beyond the limitations.
In fact, I want to have four tables:
- element (contains some medtadata of an osm object)
- node (linked node geometry of a element)
- line (linked line geometry of a element)
- polygon (linked polygon geometry of a element)
In my case I don't care if it is a relation, way or node.
A way can be a polygon (`is_closed()`) or just a simple line.
A relation can be (multiple) polygon(s) (also with holes), disjoint polygons, or just straight lines.
osm2pgsql is very oriented on node/way/relation structure and is restricting access to e.g. `as_geometrycollection()` outside of relation processing.
Is there a way to do what I want without having a lot of intermediate tables and disk usage?
I was thinking (as I use triggers anyway, to push all geom as `geometrycollection` into my `element` table and do all the processing inside a trigger, like filling my geometry tables. But as I descibed above, `as_geometrycollection()` is exclusive to relations. I understand `geometrycollection` as a universal container for several geometries. I'm not sure if this is the right thinking tho!
So I think my demand with the centroid processing was just a side effect of an incomplete plan. You have to decide, if you want to investigate this further.
Can you give me a suggestion on how to approach my import?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1771#issuecomment-1255198824
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/osm2pgsql/issues/1771/1255198824 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220922/f3ff00a3/attachment.htm>
More information about the Tile-serving
mailing list