[postgis-users] postgis-users Digest, Vol 125, Issue 28
Yamini Singh
yaminijsingh at live.com
Wed Aug 1 01:04:47 PDT 2012
Hi Tom,
I am working with multipolygons because some of my states have holes in it and some have islands. 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.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.I hope i have clarified my problem better.
Thanks Yamini
> From: postgis-users-request at postgis.refractions.net
> Subject: postgis-users Digest, Vol 125, Issue 28
> To: postgis-users at postgis.refractions.net
> Date: Tue, 31 Jul 2012 12:00:01 -0700
>
> ------------------------------
>
> Message: 2
> Date: Mon, 30 Jul 2012 22:05:23 +0200
> From: Tom van Tilburg <tom.van.tilburg at gmail.com>
> Subject: Re: [postgis-users] distance from centroid to the points that
> form the outer boundary of the polygon
> To: postgis-users at postgis.refractions.net
> Message-ID: <5016E903.4080301 at gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>
> Hi Yamini,
>
> Are you sure that multipolygons is what you want to work with? Since a
> multipolygon can consist of multiple polygons (obviously) who share a
> common centroid that can be way outside your actual polygons.
>
> That said, I would make use of ST_Dumppoints to do that.
> Something like:
> ============
> WITH pointsdump AS
> (
> SELECT gid, ST_Centroid(geom) AS centre, (ST_Dumppoints(geom)).geom
> AS point FROM polygontable
> )
>
> SELECT gid, ST_Distance(centre, point) AS distance FROM pointsdump
> ===========
>
> Now for every point in a geometry with a known gid you will see the
> distance to it's centroid.
> You can do statistics on these numbers with something like:
> SELECT gid, avg(distance) avg, max(distance) max, etc... FROM
> results GROUP BY gid
>
> Cheers,
> Tom
>
> On 30-7-2012 15:04, Yamini Singh wrote:
> >
> > Hi All,
> >
> > I am looking for suggestions for the following problem I have at hand.
> >
> > 1.I have a table that contain multipolygons
> >
> > 2.I want to calculate the maximum distance of points that form the
> > polygon from the centroid of the polygon. For example of the polygon
> > is formed of 50 points then I want to have distance of all the 50
> > points from the centroid of the polygon.
> >
> > I am not sure if someone has done this before. But I am finding it
> > difficult to implement it. Any help in this regards is welcome...
> >
> >
> > Best,
> >
> > YJS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120801/c9e01671/attachment.html>
More information about the postgis-users
mailing list