[postgis-users] operator && return errors where st_overlaps or st_intersects does not

Huub Fleuren huub.fleuren at geodan.nl
Thu Nov 21 07:27:12 PST 2013


Hello,


I found that there is a difference in result between using A && B 
operator or one of the geo functions like st_intersects(A,B) or 
st_overlaps(A,B)

While the st_intersects or st_overlaps functions returns query results 
without errors the operator version SOMETIMES results in errors over the 
SRID:

ERROR:  Operation on two geometrys with different SRID's.

ERROR: Operation on two geometrys with different SRIDs
SQL state: XX000

All of the 3552 records are OKE, having the correct SRID, all 2D, all vaid.

select st_srid(geometry) ,count(*) from soils.vw_zones  group by 
st_srid(geometry)
SELECT ST_Dimension(geometry), count(*) from soils.vw_zones  group by 
ST_Dimension(geometry)
SELECT ST_isvalid(geometry), count(*) from soils.vw_zones  group by 
ST_isvalid(geometry)

Everything runs on ubuntu
-The SQL query is generated by MAPSERV 5.6.1 WMS server
-Postgres Version 9.0.5
-Postgis version 1.5


Sample query:

     Operator &&

     select 
encode(AsBinary(force_collection(force_2d("geometry")),'NDR'),'hex') as 
geom, "id"
     from (select * from soils.vw_zones) as vw
     where geometry && GeomFromText('POLYGON((75722.1945223652 
437331.342330005,75722.1945223652 503295.946741193,169438.897876772 
503295.946741193,169438.897876772 437331.342330005,75722.1945223652 
437331.342330005))',find_srid('','soils.vw_zones','geometry'))

     ST_INTERSECTS

     select 
encode(AsBinary(force_collection(force_2d("geometry")),'NDR'),'hex') as 
geom, "id"
     from (select * from soils.vw_zones) as vw
     where 
st_intersects(geometry,GeomFromText('POLYGON((75722.1945223652 
437331.342330005,75722.1945223652 503295.946741193,169438.897876772 
503295.946741193,169438.897876772 437331.342330005,75722.1945223652 
437331.342330005))',find_srid('','soils.vw_zones','geometry')))



Regards, Huub



-- 

E huub.fleuren at geodan.nl <mailto:huub.fleuren at geodan.nl>

<http://www.geodan.nl/disclaimer>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131121/6ccb12e2/attachment.html>


More information about the postgis-users mailing list