[postgis-users] Center of Points
Gustavo Henrique Sberze Ribas
gribas at cpqd.com.br
Thu Mar 9 05:42:35 PST 2006
Hallo,
> 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.
Well, I've forgot to include commas to separate the points. This
wasn't an issue with PostGIS 0.9 but version 1.0 complained about it.
Anyway, I've tested it against the versions I had available:
POSTGIS="1.0.1" GEOS="2.1.1" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS DBPROC="0.3.0" RELPROC="0.3.0"
PostgreSQL 8.0.3
and
POSTGIS="0.9.0" GEOS="2.0.1" PROJ="Rel. 4.4.8, 3 May 2004" USE_STATS DBPROC="0.0.1" RELPROC="0.0.1"
PostgreSQL 8.0.0
both worked. Perhaps there's something wrong with your installation?
> 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.
You're right. Just in case you're curious (I was) the green point in the
attached picture shows the convex hull's centroid. The numeric results
are
pointscentroid = POINT(-47.3229673751195 -22.7344596651925)
convexhullcentroid = POINT(-47.3570658875554 -22.6784457605688)
the query I used is attached below.
Servus,
Gustavo
--
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))) as PointsCentroid
,asText(centroid(convexhull(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)))) as ConvexHullCentroid
-------------- next part --------------
A non-text attachment was scrubbed...
Name: centroid.gif
Type: image/gif
Size: 4129 bytes
Desc: centroid.gif
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060309/f894eb5c/attachment.gif>
More information about the postgis-users
mailing list