reVeal.overlay.calc_sum_area#
- calc_sum_area(zones_df, dset_src, where=None, **kwargs)[source]#
Calculate the sum of combined areas of input features intersecting each zone in input zones dataframe. Intersecting features are unioned before calculating areas, such that the total area cannot exceed the size of the zone.
- Parameters:
zones_df (geopandas.GeoDataFrame) – Input zones dataframe, to which results will be aggregated. This function assumes that the index of zones_df is unique for each feature. If this is not the case, unexpected results may occur.
dset_src (str) – Path to input vector dataset with geometries whose areas will be summed. Expected to a be a Polygon or MultiPolygon input, though this is not checked. Results for Points/MultiPoints and LineStrings/MultiLineStrings will be returned as all zeros. Must be in the same CRS as the zones_df.
where (str, optional) – Optional query string to apply to the input dset_src to subset the features included in the results. Should follow the format expr defined in pandas.DataFrame.query.
**kwargs – Arbitrary keyword arguments. Not used, but allows passing extra parameters.
- Returns:
pandas.DataFrame – Returns a pandas DataFrame with a “value” column, representing the sum of combined area of features in each zone. The index from the input zones_df is also included.