Territory grade and criteria
[31]:
import geopandas as gpd
import sys
sys.path.append('..')
import geopandas as gpd
import pandas as pd
Initialization
Specify the right local CRS for yout territory (make sure it is Projection CRS, not the Geographical CRS)
[16]:
local_crs = 32637
Initialize the territory
[17]:
terr = gpd.read_file('territory.geojson')
terr.plot()
[17]:
<Axes: >

Territory grade (frame-based)
Use the results obtained from transport_frames.frame.get_frame()
and transport_frames.frame.weight_roads()
[18]:
import pickle
with open("weighted_frame.pkl", "rb") as f:
weighted_frame = pickle.load(f)
Grade is assigned to the territory based on its linear distance to federal and regional roads
[19]:
from transport_frames.criteria import grade_territory
graded_terr = grade_territory(weighted_frame, terr)
graded_terr
[19]:
name | geometry | grade | |
---|---|---|---|
0 | Донской | POLYGON ((38.24402 53.92843, 38.24521 53.92841... | 4.0 |
Territory criteria
District polygons and settlement points are used for calculating quartile of settlement connectivity of the territory (aggregated by polygons)
[20]:
districts_polygons = gpd.read_file('/Users/polina/Desktop/github/transport_frames/data/Тульская_область/district.geojson')
settlement_points = gpd.read_file('/Users/polina/Desktop/github/transport_frames/data/Тульская_область/Тульская_область_region_points.geojson')
Initialize the gdfs of railway stations, bus stops, fuel stations and aerodromes. The services should be presented as shapely.Point
[21]:
railway_stations = gpd.read_file(f'/Users/polina/Desktop/github/transport_frames/data/Тульская_область/railway_station.geojson')
bus_stops = gpd.read_file(f'/Users/polina/Desktop/github/transport_frames/data/Тульская_область/bus_stop.geojson')
fuel_stations = gpd.read_file(f'/Users/polina/Desktop/github/transport_frames/data/Тульская_область/Копия fuel.geojson')
local_aerodrome = gpd.read_file(f'local_aerodrome.geojson')
Criteria is calculated based on drive and public tranport connectivity, frame-based grade, distance to the services.
Connectivity data can be obtained using pre-calculated adjacency matrices or calculated automatically based on graphs.
Adjacency matrices for drive and PT graphs can be calculated using iduedu.get_adj_matrix_gdf_to_gdf()
Drive and intermodal graphs can be obtained using transport_frames.graph.get_graph_from_polygon()
and iduedu.get_all_intermodal_graph()
[22]:
drive_mx = pd.read_pickle('drive_mx.pkl')
inter_mx = pd.read_pickle('pt_mx.pkl')
[23]:
from transport_frames.criteria import get_criteria
criteria_gdf = get_criteria(graded_terr=graded_terr,
points=settlement_points,
polygons=districts_polygons,
drive_graph=None,
PT_graph=None,
r_stops=railway_stations,
b_stops=bus_stops,
ferry = None,
aero=local_aerodrome,
adj_mx_drive=drive_mx,
adj_mx_PT=inter_mx,
local_crs=local_crs
)
criteria_gdf
[23]:
geometry | name | grade | weight | weight_r_stops | weight_b_stops | weight_ferry | weight_aero | car_access_quartile | public_access_quartile | car_grade | public_transport_grade | overall_assessment | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | POLYGON ((38.24402 53.92843, 38.24521 53.92841... | Донской | 4.0 | 0.7 | 0.35 | 0.35 | 0.0 | 0.0 | 1 | 1 | 4.0 | 3.5 | 3.75 |
Criteria interpretation
[24]:
from transport_frames.criteria import interpret_gdf
interpret_gdf(criteria_gdf)
[24]:
[('Донской',
['Территория расположена в непосредственной близости от одной из региональной трассы (в радиус 5 км от границ территории попадает хотя бы 1 узел региональной трассы, а ближайший федеральный узел находится в не более чем 10км);',
'Территория попадает в I квартиль связности (лучшие 25% МО) на личном транспорте;',
'Территория попадает в I квартиль связности (лучшие 25% МО) на общественном транспорте;',
'В радиусе 15 км отсутствуют порты/причалы/переправы, аэродромы.'])]