Name

ST_Intersects — Return true if the raster spatially intersects a separate raster or geometry. If the band number is not provided (or set to NULL), only the convex hull of the raster is considered in the test. If the band number is provided, only those pixels with value (not NODATA) are considered in the test.

Synopsis

boolean ST_Intersects( raster rasta , integer nbanda , raster rastb , integer nbandb );

boolean ST_Intersects( raster rasta , raster rastb );

boolean ST_Intersects( raster rast , integer nband , geometry geommin );

boolean ST_Intersects( raster rast , geometry geommin , integer nband=NULL );

boolean ST_Intersects( geometry geommin , raster rast , integer nband=NULL );

Description

Return true if the raster spatially intersects a separate raster or geometry. If the band number is not provided (or set to NULL), only the convex hull of the raster is considered in the test. If the band number is provided, only those pixels with value (not NODATA) are considered in the test.

[Note]

Depending on the order that the raster and geometry is passed to ST_Intersects(), the test will operate in either raster-space or geometry-space. If ST_Intersects(raster, ....), the test is in raster-space (the geometry is converted to a raster). If ST_Intersects(geometry, ...), the test is in geometry-space (the raster is converted to a set of pixel polygons).

[Note]

This operand will make use of any indexes that may be available on the geometries / rasters.

Enhanced: 2.0.0 support raster/raster intersects was introduced.

Examples

SELECT A.rid, g.gid , ST_Intersects(A.rast, g.geom) As inter
FROM dummy_rast AS A CROSS JOIN 
	(VALUES (1, ST_Point(3427928, 5793243.85) ) ,
		(2, ST_GeomFromText('LINESTRING(3427927.85 5793243.75,3427927.8 5793243.75,3427927.8 5793243.8)') ),
		(3, ST_GeomFromText('LINESTRING(1 2, 3 4)') )
		) As g(gid,geom)
WHERE A.rid =2 ;

 rid | gid | inter
-----+-----+-------
   2 |   1 | t
   2 |   2 | t
   2 |   3 | f

See Also

ST_Intersection