<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1422998603914_432896"><span></span></div><div id="yui_3_16_0_1_1422998603914_432900" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"><div id="yui_3_16_0_1_1422998603914_432899" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"><br><div id="yui_3_16_0_1_1422998603914_432955" class="y_msg_container"><div id="yiv8600989841"><div id="yui_3_16_0_1_1422998603914_432954"><div id="yui_3_16_0_1_1422998603914_432953" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div class="qtdSeparateBR"><br><br></div><div class="yiv8600989841yqt8656236462" id="yiv8600989841yqtfd92783">> I have many different polygons in my database and would like to know if<br clear="none">> there's any way to find out if a polygon has the shape of a circle. I<br clear="none">> searched both on Google and in the Postgis documentation but couldn't find<br clear="none"><div id="yiv8600989841yui_3_16_0_1_1422998603914_310637">> someone with the same question.</div></div><div id="yiv8600989841yui_3_16_0_1_1422998603914_310638"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310640">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 :-)<br clear="none"></div><div id="yiv8600989841yui_3_16_0_1_1422998603914_310653"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310654">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.</div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310659"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310690">Something along the lines of (off the top of my head - this will need work to work):</div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310691">select count(distinct(ST_Distance(ST_Centroid(geom),((ST_DumpPoints(ST_exteriorRing(geom))).geom)))) <br clear="none"></div><div id="yiv8600989841yui_3_16_0_1_1422998603914_321244"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321255">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.<br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321262"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321263">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. </div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321267"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321281">Cheers<br class="yiv8600989841" style="" clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321261"><br clear="none"></div><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_321256">Brent Wood<div class="yiv8600989841yqt8656236462" id="yiv8600989841yqtfd17708"><br clear="none"></div></div><div class="yiv8600989841yqt8656236462" id="yiv8600989841yqtfd80596"><div dir="ltr" id="yiv8600989841yui_3_16_0_1_1422998603914_310656"><br clear="none"></div></div></div></div></div><br><br></div> </div> </div>  </div></body></html>