Very nice approach. Select ST_MakePoint(avg(ST_X(point_teom)), avg(ST_Y(point_geom))) FROM pb_statistics WHERE pg_debit =1;
On Mon, Sep 14, 2009 at 1:03 PM, Rick <[email protected]> wrote: > 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 <[email protected]> > 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 <[email protected]> >> 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 >> > [email protected] >> > http://postgis.refractions.net/mailman/listinfo/postgis-users >> > >> _______________________________________________ >> postgis-users mailing list >> [email protected] >> http://postgis.refractions.net/mailman/listinfo/postgis-users > > > > -- > Cheers! > Rick > > > _______________________________________________ > 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
