Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates for 1.8.0 #77

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 15 additions & 4 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 @@ -271,10 +272,20 @@
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"# how many CPUs do you have\n",
"mp.cpu_count()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# %%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=2)"
"# routes = ox.shortest_path(G, origs, dests, weight=\"travel_time\", cpus=None)"
]
},
{
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
7 changes: 4 additions & 3 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 @@ -73,7 +72,7 @@
"# add node elevations from multiple raster files\n",
"# no nulls should remain\n",
"raster_paths = [\"./input_data/elevation1.tif\", \"./input_data/elevation2.tif\"]\n",
"G = ox.elevation.add_node_elevations_raster(G, raster_paths)\n",
"G = ox.elevation.add_node_elevations_raster(G, raster_paths, cpus=1)\n",
"assert not np.isnan(np.array(G.nodes(data=\"elevation\"))[:, 1]).any()"
]
},
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