[postgis-users] Center of Points Collection

Rick graham.rick at gmail.com
Mon Sep 14 13:03:11 PDT 2009


It occurs to me that, depending on what you want, you might try averaging
the points to get a median, since you don't have a shape, and thus no
concept of area to produce a centroid.

i.e. add them all up and divide by the number of points.

On Mon, Sep 14, 2009 at 3:28 PM, Paul Ramsey <pramsey at cleverelephant.ca>wrote:

> Faster than creating a multipoint is to recognize that ST_Centroid()
> is just going to return the center of the bbox of the collection
> anyways, so you can replace it with.
>
> SELECT ST_Centroid(ST_Extent(point_geom)) FROM pb_statistics WHERE pg_debit
> =1;
>
> If you want to do it the hard way, then:
>
> SELECT ST_Centroid(ST_Collect(point_geom)) FROM pb_statistics WHERE
> pg_debit =1;
>
> P.
>
> On Mon, Sep 14, 2009 at 12:24 PM, Dustin Butler <dustin at intrcomm.net>
> wrote:
> > Hello,
> >
> > Trying to figure out how to find center using a collection of points.
>  For
> > example something like this which doesn't work but you get the idea.
> >
> > SELECT ST_AsText(ST_Centriod(SELECT point_geom FROM pb.pb_statistics
> WHERE
> > pb_debit=1));
> >
> > I think I need to make a multipoint geom out of the points and pass that
> but
> > haven't figure out yet.
> >
> > Thanks,
> > Dustin Butler
> > Intrcomm Technology
> >
> > Skype: dustinbutler
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
Cheers!
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090914/3a53a895/attachment.html>


More information about the postgis-users mailing list