[Tile-serving] [openstreetmap/osm2pgsql] WORK IN PROGRESS: Add pole_of_inaccessibility() function in Lua for polygons (PR #1822)

Paul Norman notifications at github.com
Fri Dec 23 13:42:09 UTC 2022


I've been playing with PIA via PostGIS in my latest style, and on the whole, it's better than other placement methods but does have some weaknesses.

My theory is that a better label placement algorithm is to take the inscribed ellipse with a maximum area. This can be done by rotating and scaling the polygon by different values, computing the maximum inscribed circle, undoing the rotation and scaling to compute the area, and then returning the point from the ellipse with the maximum area.

For practical reasons, it's not possible to try this for every possible scaling and rotation, so I've done it by scaling by 1.0, some hand-selected values, and the aspect ratio of the bounding box of the polygon. Assuming my theory above holds, this will return either the PIA or a point better than the PIA. I haven't tackled rotation, but my idea is to do a couple of rotations.

This is not perfect, but in my tests, does deal with the weaknesses of PIA while not causing any problems.

I'm not sure how we would handle the compute multiple points and select one based on properties of the computation in osm2pgsql.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1822#issuecomment-1363962841
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/pull/1822/c1363962841 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20221223/8a969de0/attachment.htm>


More information about the Tile-serving mailing list