Оценка территории по критериям
[1]:
# import osmnx as ox
import geopandas as gpd
import warnings
import sys
import os
warnings.filterwarnings("ignore")
sys.stderr = open(os.devnull, 'w')
# local crs
local_crs = 32636
[2]:
from popframe.method.popuation_frame import PopulationFrame
from popframe.models.region import Region
# region_model = Region.from_pickle('C:\Code\PopFrame\Ленинградская область.pickle')
region_model = Region.from_pickle('data/Ленинградская область.pickle')
[3]:
frame_method = PopulationFrame(region=region_model)
output = frame_method.build_circle_frame()
output
[3]:
| id | name | population | level | geometry | |
|---|---|---|---|---|---|
| 0 | 0 | Болото | 10 | Малое сельское поселение | POLYGON ((543177.545 6580637.216, 543177.376 6... |
| 1 | 1 | Большой Остров | 68 | Малое сельское поселение | POLYGON ((544624.73 6593227.683, 544624.288 65... |
| 2 | 2 | Бор | 1734 | Большое сельское поселение | POLYGON ((545358.957 6593052.346, 545356.725 6... |
| 3 | 3 | Бороватое | 10 | Малое сельское поселение | POLYGON ((544028.318 6589581.591, 544028.148 6... |
| 4 | 4 | Бочево | 10 | Малое сельское поселение | POLYGON ((538575.316 6576793.156, 538575.147 6... |
| ... | ... | ... | ... | ... | ... |
| 2925 | 2925 | Апраксин Бор | 313 | Среднее сельское поселение | POLYGON ((399256.679 6560340.947, 399255.73 65... |
| 2926 | 2926 | Александровка | 313 | Среднее сельское поселение | POLYGON ((404164.108 6562086.557, 404163.159 6... |
| 2927 | 2927 | Большая Горка | 313 | Среднее сельское поселение | POLYGON ((413313.678 6573792.753, 413312.73 65... |
| 2928 | 2928 | Дроздово | 5 | Малое сельское поселение | POLYGON ((412482.916 6574810.78, 412482.796 65... |
| 2929 | 2929 | Большая Кунесть | 5 | Малое сельское поселение | POLYGON ((412183.794 6574629.673, 412183.674 6... |
2930 rows × 5 columns
[4]:
from popframe.method.agglomeration import AgglomerationBuilder
# Создаем экземпляр класса и запускаем процесс создания агломераций
agglomeration_builder = AgglomerationBuilder(region=region_model)
final_agglomerations = agglomeration_builder.get_agglomerations()
final_agglomerations
[4]:
| type | core_cities | population | agglomeration_level | geometry | |
|---|---|---|---|---|---|
| 0 | Polycentric | Гатчина, Тосно, Мурино, Сертолово, Новое Девят... | 1116875 | 4 | POLYGON ((310261.047 6587674.368, 310046.437 6... |
| 1 | Polycentric | Выборг, Светогорск | 129217 | 1 | POLYGON ((264064.801 6702843.886, 263672.547 6... |
| 2 | Polycentric | Тихвин, Бокситогорск, Пикалево | 105381 | 1 | POLYGON ((535225.286 6582852.229, 535504.813 6... |
| 3 | Polycentric | Волхов, Кириши | 102494 | 1 | POLYGON ((421196.961 6582742.806, 421196.513 6... |
| 4 | Polycentric | Сланцы, Кингисепп | 115479 | 1 | POLYGON ((206722.793 6553056.587, 206615.98 65... |
| 5 | Monocentric | Луга | 58784 | 1 | POLYGON ((306605.524 6486633.39, 306526.354 64... |
| 6 | Polycentric | Подпорожье, Лодейное Поле | 44609 | 1 | POLYGON ((513102.444 6711145.664, 512912.14 67... |
| 7 | Monocentric | Приозерск | 30441 | 1 | POLYGON ((337963.013 6743785.69, 337736.871 67... |
[5]:
from popframe.method.territory_evaluation import TerritoryEvaluation
from popframe.models.region import Region
from shapely.geometry import shape
geojson_data = {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[29.982879431084967, 59.363554752593245],
[29.982879431084967, 59.322083801173534],
[30.109075699649765, 59.322083801173534],
[30.109075699649765, 59.363554752593245],
[29.982879431084967, 59.363554752593245]
]
]
},
"properties": {},
"type": "Feature"
}
# Преобразуем словарь в геометрию
geom = shape(geojson_data['geometry'])
# Создаем GeoDataFrame
territories_gdf = gpd.GeoDataFrame([{'geometry': geom}], crs='EPSG:4326')
evaluation = TerritoryEvaluation(region=region_model)
# Пример вызова функции
results = evaluation.population_criterion(territories_gdf=territories_gdf)
results
[5]:
[{'project': None,
'average_population_density': 17.2,
'total_population': 39739,
'score': 4.0,
'interpretation': 'Территория имеет хорошие показатели численности и плотности населения, что способствует ее активному развитию.'}]
[6]:
from popframe.method.territory_evaluation import TerritoryEvaluation
from shapely.geometry import shape
geojson_data = {
"geometry": {
"type": "Polygon",
"coordinates": [
[
[29.982879431084967, 59.363554752593245],
[29.982879431084967, 59.322083801173534],
[30.109075699649765, 59.322083801173534],
[30.109075699649765, 59.363554752593245],
[29.982879431084967, 59.363554752593245]
]
]
},
"properties": {},
"type": "Feature"
}
geom = shape(geojson_data['geometry'])
# Создаем GeoDataFrame
territories_gdf = gpd.GeoDataFrame([{'geometry': geom}], crs='EPSG:4326')
result = evaluation.evaluate_territory_location(territories_gdf=territories_gdf)
result
[6]:
[{'territory': 'None',
'score': 5,
'interpretation': 'Территория находится внутри или непосредственной близости населенного пункта уровня Малый город',
'closest_settlement': 'Сиверский',
'closest_settlement1': None,
'closest_settlement2': None}]