[postgis-users] centroid function
Simon O'Malley
simonom at gmail.com
Tue Aug 23 00:48:31 PDT 2005
Hi All
How accurate is the centroid function. Is the generated point
geometry guaranteed to lie within the polygon it was based on. It
doesn't appear to be the case, the centroid will lie within the
feature mbr but not neccessarily the polygon itself.
I notice the notes say computation will be more accurate if performed
by the GEOS module. How do you check if it is using GEOS. My
postgis_full_version states that GEOS is enabled but is it using it
for centroid????
Try the following geometry:
select id, AsEWKT(shape) from test1 where id = '4085280';
id |asewkt
4085280 | SRID=4167;POLYGON((175.5751198833
-39.0650221,175.5748736833 -39.0647769667,175.5741390333
-39.0653570833,175.5733367333 -39.0658673167,175.5723208167
-39.0662389333,175.5722333167 -39.0662678333,175.5717718
-39.0664652333,175.57166665 -39.0664888,175.5672906
-39.0674695333,175.5654770333 -39.0682918333,175.5659457167
-39.0682377667,175.5666397 -39.0678542667,175.5673001167
-39.0675961667,175.5680912167 -39.0673477833,175.5720974333
-39.06651,175.5735548333 -39.0659992167,175.5744165
-39.0655272333,175.5751198833 -39.0650221))
(1 row)
create table test2 as select id, centroid(shape) from test1;
select id, AsEWKT(centroid) from test2;
id | asewkt
---------+-----------------------------------------------------
4085280 | SRID=4167;POINT(175.571615250557 -39.0663485015635)
Output of select postgis_full_version();
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"
Simon
More information about the postgis-users
mailing list