[postgis-users] Center of Points

Jens Werdin jens.werdin at blids.de
Thu Mar 9 04:40:42 PST 2006


I'm using postgis 1.1.0 on a postgres 8.1.2.

if i'm using your query as it is, i'm getting POINT(nan nan) too.
if i'm adding a convexhull on the geomcoll I get a POINT, but i think it is 
the center of the hull and not the center of the points.

Thx 
Jens

Am Donnerstag, 9. März 2006 12:41 schrieb Gustavo Henrique Sberze Ribas:
> Hello,
>
> > Select
> > AsText(Centroid(geomcollfromtext('GEOMETRYCOLLECTION(POINT(..
> > ..),POINT( .. ..),..)',4326)))
> >
> > and i got back POINT(nan nan);
> >
> > How can I get the center of many points?
>
>   This seems to be the correct approach, however I'd transform the
> coordinates to UTM before attempting any cartesian calculation.
> What version of postgis are you using? The following example works
> fine for me. In the picture, the polygon depicts the convex hull
> of the geometry collection and the black dot is the centroid.
>
> select asText(centroid(geomCollFromText('
>   GEOMETRYCOLLECTION (
> POINT(-47.2412222222222 -22.7405833333333)
> POINT(-47.3199166666667 -22.7333333333333)
> POINT(-47.3545555555556 -22.7443055555556)
> POINT(-47.3008346557617 -22.7133331298828)
> POINT(-47.3302764892578 -22.731388092041)
> POINT(-47.3406111111111 -22.76525)
> POINT(-47.29525 -22.7161388888889)
> POINT(-47.3481666666667 -22.7247222222222)
> POINT(-47.3160277777778 -22.7383888888889)
> POINT(-47.3275 -22.7459722222222)
> POINT(-47.34025 -22.7523333333333)
> POINT(-47.3368988037109 -22.7385997772217)
> POINT(-47.3527793884277 -22.7352771759033)
> POINT(-47.3476388888889 -22.7324444444444)
> POINT(-47.3481666666667 -22.7247222222222)
> POINT(-47.2624722222222 -22.7496944444444)
> POINT(-47.34025 -22.7523333333333)
> POINT(-47.3160277777778 -22.7383888888889)
> POINT(-47.3406111111111 -22.76525)
> POINT(-47.3275 -22.7459722222222)
> POINT(-47.3001944444444 -22.7144444444444)
> POINT(-47.3520555555556 -22.7320277777778)
> POINT(-47.2952222222222 -22.7311111111111)
> POINT(-47.3071944444444 -22.7513888888889)
> POINT(-47.2978611111111 -22.7079722222222)
> POINT(-47.3025833333333 -22.7260555555556)
> POINT(-47.3317777777778 -22.7485)
> POINT(-47.2861111111111 -22.7694444444444)
> POINT(-47.2861111111111 -22.7722222222222)
> POINT(-47.2944444444444 -22.775)
> POINT(-47.2861111111111 -22.7805555555556)
> POINT(-47.5083333333333 -22.5055555555556))',4326)))
>
> --
> Gustavo

-- 
Jens Werdin
-----------
// BLIDS - Blitz InformationsDienst von Siemens
// jens.werdin at blids.de
// 0049 721 595 2737
-----------



More information about the postgis-users mailing list