add_region_geometry_layer
site.SiteProblem.add_region_geometry_layer(region_geometry_df, common_col)Add a region geodataframe to the site problem and validate its structure.
This method processes an input GeoDataFrame (or path) containing geometry data for the region of interest. It validates the presence of required columns and aligns the data for use within the SiteProblem context.
If a preferred CRS has been passed and this dataframe is not of the preferred CRS, this dataframe will be transformed on loading to the preferred CRS. If no preferred CRS has been specified, no transformation will take place
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| region_geometry_df | geopandas.GeoDataFrame or str | The dataset containing demand information and location identifiers, or a local or web path to its location. | required |
| common_col | str | The name of the column in region_geometry_df that should be used when joining to the demand data and travel matrix. |
required |
Returns
| Name | Type | Description |
|---|---|---|
| None |
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If the required demand_col or location_id_col are missing from the provided demand_df. |
|
| TypeError if a non-geopandas dataframe is passed. |
Notes
The method updates several internal attributes: - self.demand_data: Stores the processed DataFrame. - self._demand_data_type: Stores whether the data is spatial or tabular. - self._demand_data_demand_col: Maps the demand value column. - self._demand_data_id_col: Maps the location identifier column.
See Also
_load_spatial_or_tabular_data : Internal utility for data ingestion. _validate_columns : Internal utility for schema verification.