<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi Tom,<div><br></div><div>I am working with multipolygons because some of my states have holes in it and some have islands. <span style="font-size: 10pt; ">I am really thankful to the solution provided by you. But does your solution also take care of the holes and islands. Because i want to calculate the distance of all points (on outermost boundary of multipolygons) from centroid.</span></div><div>or example, if there are holes inside the polygon then the distance to centroid should only be for the points on the outermost boundary of that polygon and should not include points of the holes as such for calculation. Similarly, if there are islands then it should considers the outermost points for calculations.</div><div>I hope i have clarified my problem better. </div><div><br></div><div><br></div><div>Thanks </div><div>Yamini<br><br><div><div id="SkyDrivePlaceholder"></div>> From: postgis-users-request@postgis.refractions.net<br>> Subject: postgis-users Digest, Vol 125, Issue 28<br>> To: postgis-users@postgis.refractions.net<br>> Date: Tue, 31 Jul 2012 12:00:01 -0700<br>> <br>> ------------------------------<br>> <br>> Message: 2<br>> Date: Mon, 30 Jul 2012 22:05:23 +0200<br>> From: Tom van Tilburg <tom.van.tilburg@gmail.com><br>> Subject: Re: [postgis-users] distance from centroid to the points that<br>>     form the outer boundary of the polygon<br>> To: postgis-users@postgis.refractions.net<br>> Message-ID: <5016E903.4080301@gmail.com><br>> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"<br>> <br>> Hi Yamini,<br>> <br>> Are you sure that multipolygons is what you want to work with? Since a <br>> multipolygon can consist of multiple polygons (obviously) who share a <br>> common centroid that can be way outside your actual polygons.<br>> <br>> That said, I would make use of ST_Dumppoints to do that.<br>> Something like:<br>> ============<br>> WITH pointsdump AS<br>> (<br>>      SELECT gid, ST_Centroid(geom) AS centre, (ST_Dumppoints(geom)).geom <br>> AS point FROM polygontable<br>> )<br>> <br>> SELECT gid, ST_Distance(centre, point) AS distance FROM pointsdump<br>> ===========<br>> <br>> Now for every point in a geometry with a known gid you will see the <br>> distance to it's centroid.<br>> You can do statistics on these numbers with something like:<br>>      SELECT gid, avg(distance) avg, max(distance) max, etc... FROM <br>> results GROUP BY gid<br>> <br>> Cheers,<br>>   Tom<br>> <br>> On 30-7-2012 15:04, Yamini Singh wrote:<br>> ><br>> > Hi All,<br>> ><br>> > I am looking for suggestions for the following problem I have at hand.<br>> ><br>> > 1.I have a table that contain multipolygons<br>> ><br>> > 2.I want to calculate the maximum distance of points that form the <br>> > polygon  from the centroid of the polygon. For example of the polygon <br>> > is formed of 50 points then I want to have distance of all the 50 <br>> > points from the centroid of the polygon.<br>> ><br>> > I am not sure if someone has done this before. But I am finding it <br>> > difficult to implement it. Any help in this regards is welcome...<br>> ><br>> ><br>> > Best,<br>> ><br>> > YJS<br><br></div></div>                                     </div></body>
</html>