spatialContains method

Future<List<Map<String, Object?>>> spatialContains(
  1. String table,
  2. String geomColumn,
  3. String polygonWkt
)

The rows of table whose geomColumn is fully contained within the polygon described by polygonWkt.

Implementation

Future<List<Map<String, Object?>>> spatialContains(
  String table,
  String geomColumn,
  String polygonWkt,
) => rawQuery(
  'SELECT t.* FROM $table AS t '
  'WHERE t.ROWID IN ('
  '  SELECT ROWID FROM ${_rtreeName(table, geomColumn)}'
  '  WHERE xmin <= MbrMaxX(GeomFromText(?)) AND xmax >= MbrMinX(GeomFromText(?))'
  '    AND ymin <= MbrMaxY(GeomFromText(?)) AND ymax >= MbrMinY(GeomFromText(?))'
  ') '
  'AND ST_Contains(GeomFromText(?), t.$geomColumn) = 1',
  [polygonWkt, polygonWkt, polygonWkt, polygonWkt, polygonWkt],
);