[postgis-users] centroid calculation

Dylan Beaudette dylan.beaudette at gmail.com
Wed Jan 9 15:19:03 PST 2008


On Wednesday 09 January 2008, David William Bitner wrote:
> ST_pointonsurface() will return a point that is guaranteed to be on the
> polygon.  I believe that this point is the point that is at a maximum
> distance from any edge.  This may be more useful for your case than a
> centroid.   There is no such thing as a logically correct "centroid", there
> is only what a centroid *is* and what it is may not be on the surface of a
> polygon.


David,

Thanks for the clarification. I suppose that I should have looked over the 
documentation a little closer. The ST_pointonsurface() function does exactly 
what I needed. Apologies for attempting to redefine the meaning of "centroid" 
for my own nefarious purposes [1].

Cheers,

Dylan


1. "Fun" way to interact with USDA-NCSS soil survey data in Google Earth 
(http://casoilresource.lawr.ucdavis.edu/soil_web/kml/mapunits.kml). Powered 
by PostGIS of course.




> On Jan 9, 2008 3:45 PM, Dylan Beaudette <dylan.beaudette at gmail.com> wrote:
> > Hi,
> >
> > I have noticed that the ST_centroid() function will compute
> > _geometrically_
> > correct centroids, but will not always compute _logically_ correct
> > centroids.
> >
> > For example, given two polygons defining hillslope position such that one
> > polygon defines the "ridge" and another defines the "slope". These two
> > polygons are roughly concentric and therefore the geometric centroid of
> > the
> > outermost polygon is computed to exist somewhere in the innermost
> > polygon.
> >
> > Are there any known ways to make postgis return a logically correct
> > centroid:
> > i.e. in the presence of concentric polygons force the position the
> > centroid
> > to be within the correct polygon.
> >
> > Thanks!
> >
> > Dylan
> >
> > --
> > Dylan Beaudette
> > Soil Resource Laboratory
> > http://casoilresource.lawr.ucdavis.edu/
> > University of California at Davis
> > 530.754.7341
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the postgis-users mailing list