getGeometriesIntersecting method

List<Geometry?> getGeometriesIntersecting(
  1. TableName tableName, {
  2. Geometry? geometry,
  3. List<String>? prePostWhere,
  4. int limit = -1,
  5. String? userDataField,
})

Get the geometries of a tableName intersecting a given geometry.

Note that sqlite geopackage only supports RTree index, therefore the exact intersection is done after the getGeometriesIn call on the resulting geometries. This is NOT done on the db side.

@return The list of geometries intersecting the geometry. @deprecated use getGeometriesIn. This will be removed.

Implementation

List<Geometry?> getGeometriesIntersecting(TableName tableName,
    {Geometry? geometry,
    List<String>? prePostWhere,
    int limit = -1,
    String? userDataField}) {
  if (geometry == null) {
    return getGeometriesIn(tableName,
        prePostWhere: prePostWhere,
        limit: limit,
        userDataField: userDataField);
  } else {
    var geometriesList = getGeometriesIn(
      tableName,
      envelope: geometry.getEnvelopeInternal(),
      prePostWhere: prePostWhere,
      limit: limit,
    );
    geometriesList
        .removeWhere((geom) => geom != null && !geom.intersects(geometry));
    return geometriesList;
  }
}