select st_x(st_centroid(geom)) as x, st_y(st_centroid(geom)) as y from mytable;
On Tue, Nov 24, 2009 at 9:46 AM, Robert Hicks <[email protected]> wrote: > Great thanks! I think either ST_PointOnSurface() or ST_Centroid() > should be fine, but now I need convert the geometry string into > latitude and longitude (Sorry, I should have been more clear before > what I was ultimately looking for). > > On Tue, Nov 24, 2009 at 12:40 PM, Paul Ramsey <[email protected]> > wrote: >> Ah, POINT(avg(X), avg(Y))... >> >> On Tue, Nov 24, 2009 at 9:38 AM, Kevin Neufeld <[email protected]> >> wrote: >>> Maxime van Noppen wrote: >>>> >>>> Paul Ramsey wrote: >>>>> >>>>> Use ST_Centroid() then. It's just the mid-point of the bbox, so it's >>>>> fast to calculate. >>>> >>>> It might be outside the polygon though. >>>> >>> >>> In which case, if it matters, use ST_PointOnSurface(). >>> >>> Paul, just a clarification, I believe centroid calculates the geometric >>> centre of a geoemtry or "centre of mass" and not the mid-point of the bbox. >>> Here are a few pictorial examples: >>> http://postgis.org/documentation/manual-1.5SVN/ST_Centroid.html >>> >>> -- Kevin >>> _______________________________________________ >>> postgis-users mailing list >>> [email protected] >>> http://postgis.refractions.net/mailman/listinfo/postgis-users >>> >> _______________________________________________ >> postgis-users mailing list >> [email protected] >> http://postgis.refractions.net/mailman/listinfo/postgis-users >> > > > > -- > web http://www.hyxspace.com > aim hyx1138 > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
