[postgis-users] Center of Points Collection

Dustin Butler dustin at intrcomm.net
Mon Sep 14 15:25:08 PDT 2009


Thanks, that worked great.

Dustin Butler
Intrcomm Technology

Skype: dustinbutler


------ Original Message ------
From: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon, 14 Sep 2009 12:28:27 -0700
To: Dustin Butler <dustin at intrcomm.net>, PostGIS Users Discussion <postgis-users at postgis.refractions.net>
Subject: Re: [postgis-users] Center of Points Collection

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
>



More information about the postgis-users mailing list