[postgis-users] Center of Points

Jens Werdin jens.werdin at blids.de
Thu Mar 9 02:14:38 PST 2006

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

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

More information about the postgis-users mailing list