[postgis-users] postgis on fedora ...

Michael Fuhr mike at fuhr.org
Sun Nov 26 09:28:46 PST 2006


On Sun, Nov 26, 2006 at 06:52:13PM +0530, Sandeep Kumar Jakkaraju wrote:
> when i am runnig this query
> 
> select name from tiles where contains(tilebounds,GEOMFROMTEXT('POINT(0
> 0)'));
> 
> I get this error :
> 
> NOTICE:  IllegalArgumentException: point array must contain 0 or >1 elements
> ERROR:  POSTGIS2GEOS conversion failed

I'd guess that you have at least one bad geometry, e.g., a POLYGON
with a ring that has exactly one point.  The following example
replicates the above error:

CREATE TABLE tiles (name text);
SELECT AddGeometryColumn('tiles', 'tilebounds', -1, 'GEOMETRY', 2);
INSERT INTO tiles (name, tilebounds) VALUES ('test', '0103000000010000000100000000000000000000000000000000000000');

SELECT name, AsText(tilebounds) FROM tiles;
 name |     astext     
------+----------------
 test | POLYGON((0 0))
(1 row)

SELECT name FROM tiles WHERE Contains(tilebounds, GeomFromText('POINT(0 0)'));
NOTICE:  IllegalArgumentException: point array must contain 0 or >1 elements

ERROR:  POSTGIS2GEOS conversion failed

You might be able to find the bad geometry with isvalid() or
npoints():

SELECT name, AsText(tilebounds) FROM tiles WHERE NOT isvalid(tilebounds);
SELECT name, AsText(tilebounds) FROM tiles WHERE npoints(tilebounds) = 1;

-- 
Michael Fuhr



More information about the postgis-users mailing list