Opened 4 weeks ago

Last modified 4 weeks ago

#5706 new enhancement

Proposal: New function ST_RemoveSmallParts()

Reported by: gluser1357 Owned by: pramsey
Priority: medium Milestone: PostGIS 3.5.0
Component: postgis Version: master
Keywords: Cc:

Description

I'd like to contribute another new Postgis function, ST_RemoveSmallParts(the_geom, minSizeX, minSizeY).

This function removes all small parts of a geometry whose dimensions are smaller than minSizeX and/or minSizeY. The function currently supports (multi-)polygons and (multi-)linestrings of dimension 2.

Often, small geometries (like the thousands of islands along the Norway coastline) make a map cluttered and harder to read at small scales. Also the rendering process will slow down noticeably. Removing those small parts of a geometry (that is, small exterior or interior rings of polygons, or small linestrings) is actually a quite simple operation, but as far as I can see, there is so far no simple Postgis function available to achive this goal, just more or less complex approaches involving st_dump()/st_collect(), e. g. described in https://gis.stackexchange.com/questions/198987/how-can-i-remove-only-small-inner-rings-in-postgis. Because of this I want to propose a new function, ST_RemoveSmallParts(). According to our measures and long-term experiences, this approach can be up to 50-100 times faster than the complex approaches we have tested and can thus be advantageous for real-time applications (similar to the other one I proposed today here: https://trac.osgeo.org/postgis/ticket/5705)

The code you can find as fork of https://github.com/postgis/postgis (master) here:

https://github.com/gluser1357/postgis-fork/tree/remove_small_parts

Please see also my initial proposal (previously named 'st_remove_small_geometries') on postgis devel here:

https://lists.osgeo.org/pipermail/postgis-devel/2024-February/030261.html

Thank you for reviews, hints and comments on this function or if there's something missing.

Change History (1)

comment:1 by gluser1357, 4 weeks ago

Here the Github pull request: https://github.com/postgis/postgis/pull/768

Note: See TracTickets for help on using tickets.