Opened 7 months ago
Closed 5 months ago
#5705 closed enhancement (fixed)
Proposal: New function ST_RemoveIrrelevantPointsForView()
Reported by: | gluser1357 | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.5.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: | gluser1357 |
Description
I'd like to contribute a new Postgis function, ST_RemoveIrrelevantPointsForView (the_geom, bbox).
This function removes all coordinates being irrelevant for rendering data within a given view. In contrast to ST_Intersection(), no new coordinates will be computed. The function currently supports (multi-)polygons and (multi-)linestrings of dimension 2.
Using a test dataset containing the state borders in Europe, preprocessing with ST_RemoveIrrelevantPointsForView() leads to the same rendering result as with the original geometries. Compared with ST_Intersection(), it returns about the same number of points but is up to 20 times faster which is, as far as our long-term experience goes, advantageous for real-time applications.
The code you can find as fork of https://github.com/postgis/postgis (master) here:
https://github.com/gluser1357/postgis-fork/tree/remove_irrelevant_points_for_view
Please see also the initial discussion on postgis devel here:
https://lists.osgeo.org/pipermail/postgis-devel/2024-March/030262.html
Thank you for reviews, hints and comments on this function or if there's something missing (e. g. more edge cases).
Change History (6)
comment:1 by , 7 months ago
comment:2 by , 7 months ago
Is this guaranteed to maintain polygonal validity? This should be stated in the docs.
comment:3 by , 7 months ago
I suggest a slightly simpler function name, and one that uses terminology already in use. Perhaps ST_RemovePointsOutsideBBox
?
comment:4 by , 7 months ago
Is this guaranteed to maintain polygonal validity? This should be stated in the docs
Currently, this function does not ensure polygonial validity. I added a warning in the docs (reference_editor.xml). Should I add it also at another location?
I suggest a slightly simpler function name, and one that uses terminology already in use. Perhaps ST_RemovePointsOutsideBBox?
I was really looking for another function name but I couldn't find a better one so far describing what the function does. Since some points are kept outside the box that are required to render the same result within the bbox your suggestion doesn't exactly hit the functionality. Other suggestions are welcome :)
comment:5 by , 7 months ago
What about ST_SimplifyForView, ST_SimplifyForBBox, ST_ReducePointsForView or ST_ReducePointsForBbox?
Here the Github pull request: https://github.com/postgis/postgis/pull/767