[postgis-users] Bug in centroid() ?

Pierrick Brihaye pierrick.brihaye at culture.gouv.fr
Thu Jul 22 02:04:00 PDT 2004


Hi,

Given the following data structure :

CREATE TABLE test_table(
   gid serial NOT NULL,
   the_geom public.geometry
) WITH OIDS;
INSERT INTO test_table (the_geom)
   VALUES (GeometryFromText('POINT(149149 -2344411)',-1));

The following statement :

SELECT postgis_version(), envelope(the_geom), centroid(the_geom), 
centroid(envelope(the_geom)) FROM test_table;

Returns (reformated as rows) :

"0.8 USE_GEOS=1 USE_PROJ=1 USE_STATS=1"
"SRID=-1;POLYGON((149149 -2344411,149149 -2344411,149149 -2344411,149149 
-2344411,149149 -2344411))"
"SRID=-1;POINT(149149 -2344411)"
"SRID=-1;POINT(-1.#IND -1.#IND)"

First of all, could postgis_version() be more verbose and, for example, 
display the GEOS and the PROJ version ? It would help in debugging, 
wouldn't it ?

Second, my PostGIS version is old and maybe my problem is already fixed. 
Is so, please forgive me. I didn't see anything about this topic in the 
PostGIS and GEOS CVS logs though...

As you can see, the centroid(envelope(the_geom)) can't return a valid 
result. OK, I admit that this indirection is quite odd, but is should 
return that same result as centroid(the_geom), shouldn't it ?

Whose fault is it ? GEOS's or PostGIS's ?

Cheers,

-- 
Pierrick Brihaye, informaticien
Service régional de l'Inventaire
DRAC Bretagne
mailto:pierrick.brihaye at culture.gouv.fr
+33 (0)2 99 29 67 78



More information about the postgis-users mailing list