[postgis-users] ST_contains() throws an error

James DeMichele James.DeMichele at redfin.com
Mon Dec 31 16:51:37 PST 2007


Yeah, I thought of the same thing as well, but got the same error.

-Jamie

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Martin Davis
Sent: Monday, December 31, 2007 2:19 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] ST_contains() throws an error

It seems to me that you can't rely on the query engine either evaluating

the where conditions in the order you specify them or using 
short-circuit evaluation. Perhaps try rewriting the query:

select count(*) from
(select * from temp_places buffer
where st_isvalid(new_poly) = true and st_isvalid(redfin_poly) = true)
)
where not st_contains(t1.new_poly, t1.redfin_poly)

James DeMichele wrote:
>
> Hi,
>
> I have a table with 27000 records and each record has 2 geometry 
> columns. The first column has an original MULTIPOLYGON (named 
> original_poly), and the second column has some tweaks (buffer and 
> simplification) applied to the original data, and is also stored as a 
> MULTIPOLYGON (named new_poly).
>
> I want to get the list of these rows where the new_poly does NOT 
> contain the original_poly. The first time I ran it, I got this: 
> "ERROR: GEOS contains() threw an error!"
>
> So, then I thought that maybe some of the polygons were not valid. 
> There were 6 invalid polygons, so then I tried running this query:
>
> select count(*)
>
> from temp_places_buffer
>
> where(st_isvalid(new_poly) = true and st_isvalid(redfin_poly) = true)
>
> and not st_contains(t1.new_poly, t1.redfin_poly);
>
> Unfortunately, I still get this error:
>
> ERROR: GEOS contains() threw an error!
>
> What are possible reasons that this would still be throwing an error, 
> other than invalid polygons, since the query should now only be 
> calculating st_contains on valid polygons?
>
> I am running this version:
>
> postgis_version
>
> ---------------------------------------
>
> 1.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
>
> Thanks.
>
> -James
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list