[postgis-devel] bug, st_within not working for polygon,polygon

Ingo Klinkmann ingo at logix-tt.com
Thu Jul 17 05:00:00 PDT 2008


Mark Cave-Ayland wrote:
> Ingo Klinkmann wrote:
>> Hi,
>>
>> The st_within and st_contains functions does not work as excpected
>> when working with polygons
>> on postgis1.3, geos 3.0.
>>
>> Steps to reproduce the Problem:
>>
>> -- Create Testtable and fill with Polygons of different sizes:
>> CREATE TABLE geomtest (id serial,geom geometry) with oids;
>>
>> INSERT INTO geomtest(geom) VALUES (buffer(geometryfromtext('Point(5.0
>> 46.0)',4326),0.7,20000) );
>> INSERT INTO geomtest(geom) VALUES (buffer(geometryfromtext('Point(5.0
>> 46.0)',4326),0.5,10000) );
>> INSERT INTO geomtest(geom) VALUES (buffer(geometryfromtext('Point(5.0
>> 46.0)',4326),0.3,1000) );
>> INSERT INTO geomtest(geom) VALUES (buffer(geometryfromtext('Point(5.0
>> 46.0)',4326),0.2,100) );
>>
>> -- The polygon is within the polygons we created above
>> SELECT id  From geomtest WHERE
>> st_within(geometryfromtext('POLYGON((5.0 46.0, 5.01 46.0, 5.01 46.01,
>> 5.0 46.01, 5.0 46.0   ))',4326),geom);
>> -- RETURN 0 rows.. which is IMHO a bug..
>>
>> -- This should be same query as above (DE9-IM-Matrix from ogc-doku)
>> SELECT id  From geomtest WHERE
>> st_relate(geometryfromtext('POLYGON((5.0 46.0, 5.01 46.0, 5.01 46.01,
>> 5.0 46.01, 5.0 46.0   ))',4326),geom,'T*F**F***' );
>>
>> -- The revers-operation returns also 0 rows.
>> SELECT id  From geomtest WHERE
>> st_contains(geom,geometryfromtext('POLYGON((5.0 46.0, 5.01 46.0, 5.01
>> 46.01, 5.0 46.01, 5.0 46.0   ))',4326));
>>
>> -- Tested on:
>> -- Postgresql "8.3.3" POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1"
>> PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STAT
>> -- Postgresql "8.3.3" POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1"
>> PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS
>>
>> -- Problem does NOT occur on:
>> -- Postgresql "8.1.11" POSTGIS="1.1.6" GEOS="2.2.3-CAPI-1.1.1"
>> PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STAT
>> -- (functions without st_ on postgis 1.1.x of course)
>>
>>
>> greetings
>> Ingo Klinkmann
> 
> 
> Hi Ingo,
> 
> There are several fixes related to the containment tests in GEOS SVN -
> can you try using the latest SVN of GEOS 3 to see if that resolves the
> issue?
> 
> Paul, Mateusz etc. is it worth trying to nudge various people to get a
> GEOS 3.0.1 release out? It seems this bug is being reported a lot...
> 
> 
> ATB,
> 
> Mark.
> 
Hi,

with the current geos-trunk (http://svn.osgeo.org/geos/trunk  Revision: 2131)
the above problem is fixed.


Thx,
Ingo



More information about the postgis-devel mailing list