Skip to content

Commit 0f89d7a

Browse files
committed
docs: add network types exploration notebook and update ArcGIS project\n\n- Add network-types.ipynb for walk restriction prototyping\n- Update ArcGIS Pro project file
1 parent ed3f191 commit 0f89d7a

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed

arcgis/overture-to-arcgis.aprx

487 KB
Binary file not shown.

notebooks/network-types.ipynb

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import arcpy"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": 2,
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"FEATURES = \"overture_segments\"\n",
19+
"FIELD = \"basic_category\""
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": 5,
25+
"metadata": {},
26+
"outputs": [],
27+
"source": [
28+
"RESTRICTIONS_WALK = {\n",
29+
" 'subtype': {\n",
30+
" 'rail': {\n",
31+
" 'avoid': 'high'\n",
32+
" },\n",
33+
" 'water': {\n",
34+
" 'prohibited': 'true'\n",
35+
" }\n",
36+
" },\n",
37+
" 'class': {\n",
38+
" 'bridleway': {\n",
39+
" 'avoid': 'low'\n",
40+
" },\n",
41+
" 'cycleway': {\n",
42+
" 'avoid': 'low'\n",
43+
" },\n",
44+
" 'footway': {\n",
45+
" 'prefer': 'high'\n",
46+
" },\n",
47+
" 'living_street': {\n",
48+
" 'prefer': 'medium'\n",
49+
" },\n",
50+
" 'motorway': {\n",
51+
" 'avoid': 'high'\n",
52+
" },\n",
53+
" 'path': {\n",
54+
" 'prefer': 'high',\n",
55+
" },\n",
56+
" 'pedestrian': {\n",
57+
" 'prefer': 'high'\n",
58+
" },\n",
59+
" 'primary': {\n",
60+
" 'avoid': 'high'\n",
61+
" },\n",
62+
" 'secondary': {\n",
63+
" 'avoid': 'medium'\n",
64+
" },\n",
65+
" }\n",
66+
"}"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 6,
72+
"metadata": {},
73+
"outputs": [
74+
{
75+
"ename": "<class 'SyntaxError'>",
76+
"evalue": "expected ':' (C:/Users/joel5174/AppData/Local/Temp/ArcGISProTemp11832/xpython_11832/1317377678.py, line 12)",
77+
"output_type": "error",
78+
"traceback": [
79+
"\u001b[1;36m Cell \u001b[1;32mIn[6], line 12\u001b[1;36m\u001b[0m\n\u001b[1;33m if fld_name\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m expected ':'\n"
80+
]
81+
}
82+
],
83+
"source": [
84+
"fld_prefix = 'walk'\n",
85+
"\n",
86+
"restriction_categories = ('prefer', 'avoid', 'prohibited')\n",
87+
"type_fields = ('class', 'subtype')\n",
88+
"\n",
89+
"for fld_restriction_cat in restriction_categories:\n",
90+
"\n",
91+
" fld_name = f'{fld_prefix}_{fld_restriction_cat}'\n",
92+
"\n",
93+
" exist_fld_lst = [f.name for f in arcpy.ListFields(FEATURES)]\n",
94+
"\n",
95+
" if fld_name \n",
96+
"\n",
97+
" arcpy.management.AddField(FEATURES, field_name=fld_name, field_type='TEXT', field_length=10)\n",
98+
"\n",
99+
" for typ_fld in type_fields:\n",
100+
"\n",
101+
" with arcpy.da.UpdateCursor(FEATURES, (typ_fld, fld_name)) as ucur:\n",
102+
"\n",
103+
" for row in ucur:\n",
104+
"\n",
105+
" row[1] = RESTRICTIONS_WALK.get(typ_fld).get(row[0])\n",
106+
" "
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": null,
112+
"metadata": {},
113+
"outputs": [],
114+
"source": []
115+
}
116+
],
117+
"metadata": {
118+
"kernelspec": {
119+
"display_name": "ArcGISPro",
120+
"language": "python",
121+
"name": "python3"
122+
},
123+
"language_info": {
124+
"file_extension": ".py",
125+
"mimetype": "text/x-python",
126+
"name": "python",
127+
"version": "3.13.5"
128+
}
129+
},
130+
"nbformat": 4,
131+
"nbformat_minor": 4
132+
}

0 commit comments

Comments
 (0)