Skip to content

Commit

Permalink
updates for 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Nov 30, 2023
1 parent 22bedb9 commit 2502663
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 41 deletions.
5 changes: 2 additions & 3 deletions notebooks/00-osmnx-features-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"import networkx as nx\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -264,7 +263,7 @@
"orig_y = G.nodes[orig][\"y\"]\n",
"dest_x = G.nodes[dest][\"x\"]\n",
"dest_y = G.nodes[dest][\"y\"]\n",
"round(ox.distance.great_circle_vec(orig_y, orig_x, dest_y, dest_x))"
"round(ox.distance.great_circle(orig_y, orig_x, dest_y, dest_x))"
]
},
{
Expand Down Expand Up @@ -456,7 +455,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
5 changes: 2 additions & 3 deletions notebooks/01-overview-osmnx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"import geopandas as gpd\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -456,7 +455,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In this street network, the streets are ~16% more circuitous than the straight-lines paths would be.\n",
"In this street network, the streets are ~14% more circuitous than the straight-lines paths would be.\n",
"\n",
"For examples of analyzing street networks, see [this example](06-stats-indicators-centrality.ipynb)."
]
Expand Down Expand Up @@ -486,7 +485,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
21 changes: 16 additions & 5 deletions notebooks/02-routing-speed-time.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"metadata": {},
"outputs": [],
"source": [
"import multiprocessing as mp\n",
"\n",
"import numpy as np\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"np.random.seed(0)\n",
"ox.__version__"
]
Expand Down Expand Up @@ -253,6 +254,16 @@
"Calculating lots of shortest paths can be slow, but OSMnx has built-in shortest path solver parallelization and multiprocessing. With the `shortest_path` function, you can pass in a single origin-destination pair to solve the one shortest path, or you can pass in lists of origins and destinations to solve each shortest path between the pairs. If you're solving shortest paths for multiple origins/destinations, the `cpus` argument determines how many CPU cores to utilize for parallelized solving. Multiprocessing adds some overhead, so it's only faster if you're solving a lot of paths. It also has substantial RAM requirements (as it must copy the graph into each sub-process), so be carefuly with your RAM when setting the `cpus` argument."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# how many CPUs do you have\n",
"mp.cpu_count()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -271,10 +282,10 @@
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"# %%time\n",
"# it takes 2.3 seconds to solve all the routes using all the cores on my computer\n",
"# I have a 24-thread AMD 5900x: performance will depend on your specific CPU\n",
"routes = ox.shortest_path(G, origs, dests, weight=\"travel_time\", cpus=None)"
"routes = ox.shortest_path(G, origs, dests, weight=\"travel_time\", cpus=2)"
]
},
{
Expand All @@ -283,7 +294,7 @@
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"# %%time\n",
"# it takes 29 seconds to solve all the routes using just 1 core on my computer\n",
"routes = ox.shortest_path(G, origs, dests, weight=\"travel_time\", cpus=1)"
]
Expand Down Expand Up @@ -384,7 +395,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/03-graph-place-queries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"source": [
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -344,7 +343,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/04-simplify-graph-consolidate-nodes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"import networkx as nx\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -317,7 +316,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/05-save-load-networks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"source": [
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -184,7 +183,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/06-stats-indicators-centrality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"import osmnx as ox\n",
"import pandas as pd\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -194,7 +193,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/07-plot-graph-over-shape.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"import matplotlib.pyplot as plt\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -116,7 +115,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/08-custom-filters-infrastructure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"source": [
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.settings.log_console = True\n",
"ox.__version__"
]
Expand Down Expand Up @@ -139,7 +138,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/09-example-figure-ground.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"import osmnx as ox\n",
"from IPython.display import Image\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -575,7 +574,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions notebooks/10-building-footprints.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"import osmnx as ox\n",
"from IPython.display import Image\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -72,7 +71,7 @@
"outputs": [],
"source": [
"# save as a GeoPackage\n",
"gdf_save = gdf.applymap(lambda x: str(x) if isinstance(x, list) else x)\n",
"gdf_save = gdf.map(lambda x: str(x) if isinstance(x, list) else x)\n",
"gdf_save.drop(labels=\"nodes\", axis=1).to_file(\"./data/piedmont_bldgs.gpkg\", driver=\"GPKG\")"
]
},
Expand Down Expand Up @@ -174,6 +173,8 @@
"outputs": [],
"source": [
"# helper funcion to get one-square-mile street networks, building footprints, and plot them\n",
"\n",
"\n",
"def make_plot(\n",
" place,\n",
" point,\n",
Expand Down Expand Up @@ -269,7 +270,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/11-interactive-web-mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
5 changes: 3 additions & 2 deletions notebooks/12-node-elevations-edge-grades.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"import osmnx as ox\n",
"import pandas as pd\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -233,6 +232,8 @@
"outputs": [],
"source": [
"# define some edge impedance function here\n",
"\n",
"\n",
"def impedance(length, grade):\n",
" penalty = grade**2\n",
" return length * penalty\n",
Expand Down Expand Up @@ -358,7 +359,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/13-isolines-isochrones.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"from shapely.geometry import Point\n",
"from shapely.geometry import Polygon\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -250,7 +249,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/14-osmnx-to-igraph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"import numpy as np\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"print(ox.__version__)\n",
"print(ig.__version__)\n",
"\n",
Expand Down Expand Up @@ -225,7 +224,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/15-advanced-plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"import matplotlib.pyplot as plt\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -332,7 +331,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/16-download-osm-geospatial-features.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"source": [
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"ox.__version__"
]
},
Expand Down Expand Up @@ -139,7 +138,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 1 addition & 2 deletions notebooks/17-street-network-orientations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"import numpy as np\n",
"import osmnx as ox\n",
"\n",
"%matplotlib inline\n",
"weight_by_length = False\n",
"\n",
"ox.__version__"
Expand Down Expand Up @@ -147,7 +146,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 2502663

Please sign in to comment.