Skip to content

Commit f779f46

Browse files
committed
code clean up
1 parent f2799dc commit f779f46

6 files changed

Lines changed: 6 additions & 7 deletions

notebooks/00-osmnx-features-demo.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"outputs": [],
9191
"source": [
9292
"# get a fully bidirection network (as a MultiDiGraph)\n",
93-
"ox.settings.bidirectional_network_types += \"drive\"\n",
93+
"ox.settings.bidirectional_network_types.append(\"drive\")\n",
9494
"G = ox.graph.graph_from_place(\"Piedmont, California, USA\", network_type=\"drive\")\n",
9595
"\n",
9696
"# convert your MultiDiGraph to an undirected MultiGraph\n",

notebooks/03-graph-place-queries.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
" - `drive_service` - get drivable streets, including service roads\n",
4848
" - `walk` - get all streets and paths that pedestrians can use (this network type ignores one-way directionality)\n",
4949
" - `bike` - get all streets and paths that cyclists can use\n",
50-
" - `all` - download all non-private OSM streets and paths\n",
51-
" - `all_private` - download all OSM streets and paths, including private-access ones\n",
50+
" - `all` - download all OSM streets and paths, including private-access ones\n",
51+
" - `all_public` - download all non-private OSM streets and paths\n",
5252
"\n",
5353
"Or you can define your own fine-tuned network type using OSMnx's `custom_filter` parameter (to get just highways, or railways, canals, etc).\n",
5454
"\n",

notebooks/08-custom-filters-infrastructure.ipynb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
"\n",
146146
"# union: get all ways with either a 'cycleway:right' or 'cycleway:left' tag\n",
147147
"cf = [cf1, cf2]\n",
148-
"ox.settings.useful_tags_way.extend([cf1, cf2])\n",
149148
"G = ox.graph.graph_from_place(place, custom_filter=cf, retain_all=True)\n",
150149
"print(len(G))"
151150
]

notebooks/14-osmnx-to-igraph.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
"outputs": [],
188188
"source": [
189189
"%%time\n",
190-
"closeness2 = nx.closeness_centrality(G_nx, distance=weight, wf_improved=True)\n",
190+
"closeness2 = nx.closeness_centrality(G_nx.to_undirected(), distance=weight, wf_improved=True)\n",
191191
"max_closeness2 = max(closeness2.items(), key=operator.itemgetter(1))[0]"
192192
]
193193
},

notebooks/16-download-osm-geospatial-features.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"useful_tags = [\"access\", \"parking\", \"surface\", \"capacity\", \"fee\"]\n",
150150
"for node, feature in zip(nn, features[useful_tags].to_dict(orient=\"records\"), strict=False):\n",
151151
" feature = {k: v for k, v in feature.items() if pd.notna(v)}\n",
152-
" G.nodes[node].update({\"parking\": feature})"
152+
" G.nodes[node].setdefault(\"parking\", []).append(feature)"
153153
]
154154
},
155155
{

notebooks/17-street-network-orientations.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
" print(ox.utils.ts(), place)\n",
9999
"\n",
100100
" # get undirected graphs with edge bearing attributes\n",
101-
" G = ox.graph.graph_from_place(place, network_type=\"drive\")\n",
101+
" G = ox.graph.graph_from_place(places[place], network_type=\"drive\")\n",
102102
" Gu = ox.bearing.add_edge_bearings(ox.convert.to_undirected(G))\n",
103103
" fig, ax = ox.plot.plot_orientation(Gu, ax=ax, title=place, area=True)\n",
104104
"\n",

0 commit comments

Comments
 (0)