[postgis-users] function to check if a polygon is convex

B H hemantbist at gmail.com
Wed Mar 2 13:35:42 PST 2022


select st_equals(st_convexhull(wkb_geometry), wkb_geometry) is true  for
all st_isvalid convex polygons I tried on).
Is this a correct way to check for convexity of the polygon?


On Wed, Mar 2, 2022 at 1:15 PM 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220302/3b15bcae/attachment.html>


More information about the postgis-users mailing list