Skip to content

RS_Intersects

Returns true if the extents of the two arguments intersect.

Usage

boolean RS_Intersects(rast: raster, geom: geometry)
boolean RS_Intersects(geom: geometry, rast: raster)
boolean RS_Intersects(rastA: raster, rastB: raster)

Arguments

  • rastA (raster): Input raster
  • rastB (raster): Input raster
  • geom (geometry): Input geometry
  • rast (raster): Input raster

Description

Returns true if the convex hull of the first argument intersects the second argument. Both rasters and geometries are accepted in either argument position. When two rasters are provided, their convex hulls are compared.

If the arguments have different CRSes, the geometry is transformed into the raster’s CRS before evaluating the predicate. For two rasters, the second raster’s extent is transformed into the first raster’s CRS. If the preferred transformation fails, the extent of both sides are transformed to WGS 84 as a fallback. If either argument has no CRS set, the comparison is performed directly without CRS transformation.

Examples

SELECT RS_Intersects(RS_Example(), ST_Point(0.5, 0.5, 4326));
┌─────────────────────────────────────────────────────────────────────────────┐
│ rs_intersects(rs_example(),st_point(Float64(0.5),Float64(0.5),Int64(4326))) │
│                                   boolean                                   │
╞═════════════════════════════════════════════════════════════════════════════╡
│ false                                                                       │
└─────────────────────────────────────────────────────────────────────────────┘
SELECT RS_Intersects(RS_Example(), RS_Example());
┌──────────────────────────────────────────┐
│ rs_intersects(rs_example(),rs_example()) │
│                  boolean                 │
╞══════════════════════════════════════════╡
│ true                                     │
└──────────────────────────────────────────┘