[postgis-users] Idea for optional enhancement to ST_ChaikinSmoothing?

Marco Boeringa marco at boeringa.demon.nl
Tue May 3 03:13:02 PDT 2022


Hi all,

This is something I have been pondering about for quite some time: would 
it be technically possible to create an option in the PostGIS 
"ST_ChaikinSmoothing" function 
(https://postgis.net/docs/ST_ChaikinSmoothing.html) to skip smoothing 
near perpendicular 90 degrees angles (e.g. within 85-95 degrees?), or 
any point who's two connecting segments have a > 90 degree's angle 
between them (90-180 degree),  and only smooth "sharp" corners of < 90 
degrees?

The reason I am asking is that from a cartographer's point of view, you 
might not wish to have "square" polygons being smoothed, and there is 
also little sense in smoothing angles that are already "smooth" (> 90 
degrees).

E.g., natural forests are usually nice features to smooth, especially 
after having generalized them which tends to introduce "sharp" corners 
and spikes in places. On the contrary, artificial or highly managed 
forest tend to be divided into a "square" sections, that should 
generally not be smoothed for display in a map.

In addition, although "ST_Subdivide" is generally recommended as the 
last step in processing, so after a potential smoothing step, there may 
be technical and performance reasons why one would wish to subdivide 
earlier in a processing pipeline. If smoothing is subsequently applied 
to a subdivided dataset, gaps will appear near the perpendicular 
crosspoints of the horizontal and vertical cutting lines of 
ST_Subdivide, as these will be smoothed as well.

Of course, this should be an option, not least for the fact that it will 
likely also slow down the algorithm due to the additional computations 
to be made.

Marco




More information about the postgis-users mailing list