Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

postgis: difference with && operator and st_intersects

$
0
0

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 geometries with different SRID’s.

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

All of the records seem to be OKE, having the correct SRID, none missing.

The query is generated by MAPSERV WMS server, so what is there to do?

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')))

Viewing all articles
Browse latest Browse all 1138

Latest Images

Trending Articles



Latest Images