[postgis-users] Find out if polygon is circle

Bernecker, Wolfgang wolfgang.bernecker at helpling.com
Thu Feb 5 15:49:07 PST 2015


Thanks to all of you very much for your insightful replies!

The circles are computer-generated with 15-20 points (I should've mentioned
that from the beginning).

I very much like the compactness-approach as well as the LineToCurve.

I will try out these approaches and let you know about my solution.

Again thank you very much, this mailing list is impressive and I hope I
will be able to contribute as well.

Very best from Berlin,
Wolfgang

On 5 February 2015 at 19:56, Brent Wood <pcreso at pcreso.com> wrote:

>
>
>
> > I have many different polygons in my database and would like to know if
> > there's any way to find out if a polygon has the shape of a circle. I
> > searched both on Google and in the Postgis documentation but couldn't
> find
> > someone with the same question.
>
> The "lines" joining the vertices of a polygon are straight - so implicitly
> any polygon defined by a sequence of points is NOT a circle, but might
> approximate one. Also, a reprojected circle may no longer be round. Any
> circle can be defined by three points, but a triangle is not a circle :-)
>
> If what you are asking is whether each vertex in the polygon boundary is
> the same distance from the centroid - that might be done relatively easily.
>
> Something along the lines of (off the top of my head - this will need work
> to work):
> select
> count(distinct(ST_Distance(ST_Centroid(geom),((ST_DumpPoints(ST_exteriorRing(geom))).geom))))
>
>
> for each polygon get the vertices, then get the distance between each
> vertex & the centroid, then see how many distinct distances there are for
> each feature, if only one you have a circle - the distance being the radius.
>
> If precision becomes a problem with near zero differences creating
> apparently different radii for the polygon, you can select where max(dist)
> - min(dist) < a_very_small_number instead of all being the same.
>
> Cheers
>
> Brent Wood
>
>
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150206/475d5c83/attachment.html>


More information about the postgis-users mailing list