AlignerFeatureCollection

feature_data.AlignerFeatureCollection(
    features,
    source=None,
    id_fieldname=None,
    crs=None,
    is_reference=False,
)

A collection of AlignerFeature objects with spatial indexing and utility properties.

This class manages a group of features, providing high-level access to spatial operations like unary unions and R-tree indexing for fast spatial queries.

Attributes

Name Type Description
features dict[ThematicId, AlignerFeature] A dictionary mapping feature IDs to their corresponding AlignerFeature objects.
source dict[str, str] Metadata regarding the source of the data.
is_reference bool Flag indicating if this collection serves as the reference dataset (enables spatial indexing).
crs (CRS, optional) The Coordinate Reference System associated with the collection.

Notes

When is_reference is set to True, the collection lazily initializes a spatial index ([shapely.strtree.STRtree][]) upon the first access to the tree property.

Examples

>>> collection = AlignerFeatureCollection(features=my_feature_dict, is_reference=True)
>>> # Access the spatial index
>>> index = collection.tree
>>> # Get a union of all geometries
>>> total_area = collection.union.area

Methods

Name Description
to_geojson Converts the collection into a GeoJSON FeatureCollection format.

to_geojson

feature_data.AlignerFeatureCollection.to_geojson(geom_attributes=False)

Converts the collection into a GeoJSON FeatureCollection format.

Parameters

Name Type Description Default
geom_attributes bool If True, includes calculated geometric attributes (like area or length) in the feature properties. Defaults to False. False

Returns

Name Type Description
FeatureCollection A GeoJSON representation of the data.