aws.osml.features.feature_index module
- class aws.osml.features.feature_index.Feature2DSpatialIndex[source]
Bases:
ABC
A query-only spatial index allowing clients to lookup features using 2D geometries
- abstract find_intersects(geometry: Geometry) Iterable[Feature] [source]
Return the features intersecting the input geometry.
- Parameters:
geometry – geometry to query the index
- Returns:
the features
- abstract find_nearest(geometry: Geometry, max_distance: float | None = None) Iterable[Feature] [source]
Return the nearest feature for the input geometry based on distance within two-dimensional Cartesian space.
- Parameters:
geometry – geometry to query the index
max_distance – maximum distance
- Returns:
the nearest features
- class aws.osml.features.feature_index.STRFeature2DSpatialIndex(feature_collection: ~geojson.feature.FeatureCollection, use_image_geometries: bool = True, property_accessor: ~aws.osml.features.imaged_feature_property_accessor.ImagedFeaturePropertyAccessor = <aws.osml.features.imaged_feature_property_accessor.ImagedFeaturePropertyAccessor object>)[source]
Bases:
Feature2DSpatialIndex
Implementation of the 2D spatial index for GeoJSON features using Shapely’s Sort-Tile-Recursive (STR) tree datastructure.
- find_intersects(geometry: Geometry) Iterable[Feature] [source]
Return the features intersecting the input geometry.
- Parameters:
geometry – geometry to query the index
- Returns:
the features
- find_nearest(geometry: Geometry, max_distance: float | None = None) Iterable[Feature] [source]
Return the nearest feature for the input geometry based on distance within two-dimensional Cartesian space.
- Parameters:
geometry – geometry to query the index
max_distance – maximum distance
- Returns:
the nearest features