&& does a bounding box intersects check where as ST_Intersects does a more
intensive actual geometry intersect check.  Which is why its slower.
 
 

  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Andreas
Forø Tollefsen
Sent: Wednesday, September 22, 2010 11:00 AM
To: PostGIS Users Discussion
Subject: [postgis-users] Difference between ST_Intersects and && operator


Hi all. 
I am working on a huge vector grid project where i need to intersect country
polygon data and vector grid cells.
For this i need to first select the grid cells which intersects with the
country polygons.

SELECT DISTINCT testgrid.gid, xcoord, ycoord, cell INTO testgrid2 FROM
testgrid, cshaperef WHERE ST_Intersects(cshaperef.the_geom,
testgrid.cell)=true

I tried both the ST_Intersects and the && operator, but i cannot really
understand the difference.
After looking at my results the ST_Intersects gave exactly the cells which
intersected with the country polygons, while the && gave many additional
cells.
Another interesting observation is the the && is way faster than the
ST_Intersects which in my case 188 polygons and 212000 cells takes a lot of
time.

Could anyone please elaborate on the difference?

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to