ST_Intersects — If band numbers are omitted only considers convex hull of raster. Returns true only if rast pixel in a band with non-nodata band value intersects with a geometry/raster.
boolean ST_Intersects(
raster
rast
,
integer
band
,
geometry
geommin
);
boolean ST_Intersects(
geometry
geommin
,
raster
rast
,
integer
nband=NULL
);
boolean ST_Intersects(
raster
rasta
,
raster
rastb
);
boolean ST_Intersects(
raster
rasta
,
integer
nbanda
,
raster
rastb
,
integer
nbandb=1
);
Returns true if the geometry intersects with the raster. Nodata values are taken into account so that if the geometry intersects only with nodata values, the function returns false. If no band is specified band 1 is assumed.
![]() | |
For the case of raster/geometry and geometry/raster. ST_Intersects(raster,nband,geometry) is done in raster space (e.g. the geometry is converted to a raster before tested), ST_Intersects(geometry, raster)is done in geometry space -- raster is converted to geometry before checked. |
![]() | |
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.
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