spatialBoundingBoxFilter method

Future<List<Map<String, Object?>>> spatialBoundingBoxFilter(
  1. String table,
  2. String geomColumn,
  3. double minX,
  4. double minY,
  5. double maxX,
  6. double maxY,
)

The rows of table whose geomColumn's bounding box overlaps the rectangle ([minX], [minY])-([maxX], [maxY]).

A pure R*Tree query — the fastest and coarsest of the spatial filters, since it only tests bounding boxes, not exact geometry.

Implementation

Future<List<Map<String, Object?>>> spatialBoundingBoxFilter(
  String table,
  String geomColumn,
  double minX,
  double minY,
  double maxX,
  double maxY,
) => rawQuery(
  'SELECT t.* FROM $table AS t '
  'WHERE t.ROWID IN ('
  '  SELECT ROWID FROM ${_rtreeName(table, geomColumn)}'
  '  WHERE xmin <= ? AND xmax >= ? AND ymin <= ? AND ymax >= ?'
  ')',
  [maxX, minX, maxY, minY],
);