# [postgis-users] Center of Points

marco vieira maovieira at gmail.com
Fri Mar 10 06:12:24 PST 2006

```Jens
You can create a boundary() around your points and get the centroid() after
or simply get x() and y() from centroid(extent(the_geom)) from your set of
points. All of these is a geometric aprouch of the problem.
I think you have to decide in a statistics aprouch or a geometric aprouch.
Example: if you take the average() of x() and y() of all your points your
are aprouching in a statistic way (the expected position of a set of
points). In this case, you should know the behaviour of the phenomena mapped
to choose the best probability density function that fit your problem. Maybe
you can implement something more apropriated with R-statistics package for
postgreSQL.
Regards.

--
Marco Vieira
+55 21 9499-6800
e-mail: maovieira at gmail.com

2006/3/9, Jens Werdin <jens.werdin at blids.de>:
>
> Hello everybody,
>
> I have a problem finding the center of many points.
> What i tries was:
> writing a script which gets the coordinates of the points i wanted:
>
> select x(), y() from adresses where... order by x()
>
> then I made a linestring out of the points and got the center:
>
> Select AsText(Centroid(linestringfromtext('LINESTRING(.. .., ..
> ..,)',4326)))
>
> but I think it is not correct enough. then i tried
>
> Select
> AsText(Centroid(geomcollfromtext('GEOMETRYCOLLECTION(POINT(.. ..),POINT(
> .. ..),..)',4326)))
>
> and i got back POINT(nan nan);
>
> How can I get the center of many points?
>
> Greetings Jens
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...