It uses the Geos library to calculate centroid if Geos is installed. My cursory glance of the Geos code, looks to me like for polygons and multipolygons it first takes the area of the region and then finds the average x,y, z of that encompassing area. So yes it is conceivable in a multipolygon that the centroid may not fall in any of the polygons. Anyone correct me if I am wrong since I'm not too familiar with c++ code. Anyrate I think the relevant piece of code in geos library is source\algorithm\CentroidArea.cpp Hope that helps, Regina
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Doughty Sent: Thursday, June 14, 2007 7:03 AM To: [email protected] Subject: [postgis-users] How is Centroid(Geometry) calculated? Hi, Can anybody explain how PostGIS calculates centroids? I've checked the manual but the relevant section doesn't refer to an OGC Specification. From what I can understand, it takes an average of the coordinates of all the vertices of an entry, ignoring whether or not the centroid falls outside the polygons. Is this right? This differs from other GIS- GeoMedia, for example, when confronted with a multipolygon entry, always puts the centroid inside the largest polygon. Can anybody shed some light on this? Cheers, Matt Matt Doughty GEOGRAMA S.L. Tel.: +34 945 13 13 72 652 77 14 15 Fax: +34 945 23 03 40 www.geograma.com ----------------------------------------- The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
<<image001.jpg>>
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
