[postgis-users] function to check if a polygon is convex
Brent Wood
pcreso at yahoo.com
Wed Mar 2 13:39:42 PST 2022
Hi,
I'm not aware of such a function, but a simple workaround may be to create a convex hull from the polygon perimeter, then see if this is the same as the original polygon. Any concavities present in the original should ensure a difference.
Cheers,
Brent
On Thursday, March 3, 2022, 10:16:14 AM GMT+13, B H <hemantbist at gmail.com> wrote:
Hi,How do I check if the polygon is convex in postgis?
Things I have tried before sending this email I could not find any function like st_is_convex.I searched in google but I could not find any user defined postgres function to check for convexity of polygon either.select st_convexhull(wkb_geometry) = wkb_geometry -- this returns false for convex polygons also.
Other libraries e.g. CGAL seem to have it. So I am hoping that something is already available in postgis that I am missing.https://doc.cgal.org/Manual/3.1/doc_html/cgal_manual/Partition_2_ref/Function_convex_partition_is_valid_2.html
Best,HB_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220302/a54ec157/attachment.html>
More information about the postgis-users
mailing list