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
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users