popframe.method.territory_evaluation
Classes
|
- class popframe.method.territory_evaluation.TerritoryEvaluation(*, region: Region)[source]
Bases:
BaseMethod
- evaluate_territory_location(territories)[source]
Main function to evaluate the location of a territory relative to settlements.
- Parameters:
self – The class object containing methods to retrieve settlements and territories.
territories (GeoDataFrame) – Geospatial data with territories. If None, territories from self.region will be used.
- Returns:
A list of evaluation results for each territory.
- Return type:
list
- _get_level_scores()[source]
Returns a dictionary with scores for different levels of settlements.
- Returns:
A dictionary where the key is the settlement level and the value is the score.
- Return type:
dict
- _evaluate_single_territory(territory_geom, territory_name, settlements_gdf, level_scores)[source]
Evaluates a single territory, determining its nearest settlements and interpretation.
- Parameters:
territory_geom (geometry) – The geometry of the territory.
territory_name (str) – The name of the territory.
settlements_gdf (GeoDataFrame) – Geospatial data with settlements.
level_scores (dict) – A dictionary with settlement level scores.
- Returns:
The results of the territory evaluation.
- Return type:
dict
- _evaluate_nearby_settlement(territory_name, settlements_in_buffer, level_scores)[source]
Evaluates the territory if it is near settlements.
- Parameters:
territory_name (str) – The name of the territory.
settlements_in_buffer (GeoDataFrame) – The settlements within the buffer.
level_scores (dict) – A dictionary with settlement level scores.
- Returns:
The results of the territory evaluation.
- Return type:
dict
- _evaluate_between_settlements(territory_geom, territory_name, settlements_gdf)[source]
Evaluates the territory if it is located between settlements.
- Parameters:
territory_geom (geometry) – The geometry of the territory.
territory_name (str) – The name of the territory.
settlements_gdf (GeoDataFrame) – Geospatial data with settlements.
- Returns:
The results of the territory evaluation.
- Return type:
dict
- _find_closest_settlement_pair(territory_geom, nearby_settlements)[source]
Finds the pair of nearest settlements around the territory.
- Parameters:
territory_geom (geometry) – The geometry of the territory.
nearby_settlements (GeoDataFrame) – The nearby settlements.
- Returns:
The pair of nearest settlements and the minimum distance.
- Return type:
tuple
- population_criterion(territories)[source]
Calculates population density and assesses territories based on demographic characteristics.
Parameters: territories (GeoDataFrame or None): GeoDataFrame of territories or None to use default region territories.
Returns: list: A list of dictionaries containing the assessment results for each territory.
- _get_territories_gdf(territories)[source]
Gets the GeoDataFrame of territories, transformed to CRS 3857.
Parameters: territories (GeoDataFrame or None): GeoDataFrame of territories or None to use default region territories.
Returns: GeoDataFrame: The territories GeoDataFrame transformed to CRS 3857.
- _calculate_density_population(gdf_territory, towns_gdf, radius_m=20000)[source]
Calculates population density within a specified buffer radius for each territory.
Parameters: gdf_territory (GeoDataFrame): GeoDataFrame of territories. towns_gdf (GeoDataFrame): GeoDataFrame of towns with population data. radius_m (int, optional): Radius in meters for the buffer around each territory. Default is 20000.
Returns: list: A list of dictionaries containing population density and total population for each territory.
- _assess_territory(density, population)[source]
Assesses the territory based on population density and total population.
Parameters: density (float): The average population density of the territory. population (int): The total population of the territory.
Returns: int: The score representing the assessment of the territory.
- _interpret_score(score)[source]
Interprets the score assigned to a territory.
Parameters: score (int): The score representing the assessment of the territory.
Returns: str: The interpretation of the score.
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.