From d257b5ddedb95aa5c9d6baabdd1a3063f8756775 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 15:21:23 -0700 Subject: [PATCH 1/7] 2.0 beta 0 --- environment.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 39e4998..7585058 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,10 @@ channels: - conda-forge dependencies: - jupyterlab - - osmnx=1.9.3 - pillow - pre-commit - - python=3.11.* + - python=3.12.* - python-igraph + - pip + - pip: + - osmnx==2.0.0b0 From 7fc5a41b085e85632d21dd37affbaad4bed9ba98 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 15:24:43 -0700 Subject: [PATCH 2/7] update workflow --- .github/workflows/tests.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4814e17..c7f6112 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,25 +23,29 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - with: - fetch-depth: 2 - name: Create environment with Micromamba uses: mamba-org/setup-micromamba@v1 with: - cache-downloads: true cache-environment: true environment-file: environment.yml post-cleanup: none - - name: Lint notebooks - run: | - SKIP=no-commit-to-branch pre-commit run --all-files + - name: Cache pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit/ + key: pre-commit-${{ matrix.os }}-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Run pre-commit checks + run: pre-commit run --all-files + env: + SKIP: no-commit-to-branch - name: Test notebooks run: | cd ./notebooks rm -r -f *.py jupyter nbconvert --to python *.ipynb - for f in *.py; do ipython "$f"; done + for filename in *.py; do ipython "$filename"; done rm -r -f *.py From fa88078e635695f74eea0f228ab05896d7a02d25 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 15:29:54 -0700 Subject: [PATCH 3/7] conda install osmnx deps --- environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment.yml b/environment.yml index 7585058..42113b7 100644 --- a/environment.yml +++ b/environment.yml @@ -3,6 +3,7 @@ channels: - conda-forge dependencies: - jupyterlab + - osmnx - pillow - pre-commit - python=3.12.* From 1d05673d747a5243705a76859243add8cfb5c586 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 15:30:06 -0700 Subject: [PATCH 4/7] show installed version before tests --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c7f6112..641e861 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,6 +44,7 @@ jobs: - name: Test notebooks run: | + ipython -c "import osmnx; print(osmnx.__version__)" cd ./notebooks rm -r -f *.py jupyter nbconvert --to python *.ipynb From 0061c4501ef970fb9f2850f03e642f65b0c2b1b9 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 15:51:13 -0700 Subject: [PATCH 5/7] fix for 2.0 --- environment.yml | 18 +++++++++++++++++- notebooks/00-osmnx-features-demo.ipynb | 2 +- notebooks/01-overview-osmnx.ipynb | 4 ++-- .../04-simplify-graph-consolidate-nodes.ipynb | 8 +++++--- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/environment.yml b/environment.yml index 42113b7..45314b7 100644 --- a/environment.yml +++ b/environment.yml @@ -1,13 +1,29 @@ name: osmnx-examples channels: - conda-forge + dependencies: + # OSMnx required/optional dependencies + - gdal + - geopandas + - matplotlib + - networkx + - numpy + - pandas + - rasterio + - requests + - scipy + - scikit-learn + - shapely + + # other packages needed for CI or running examples - jupyterlab - - osmnx - pillow - pre-commit - python=3.12.* - python-igraph + + # install OSMnx beta via pip - pip - pip: - osmnx==2.0.0b0 diff --git a/notebooks/00-osmnx-features-demo.ipynb b/notebooks/00-osmnx-features-demo.ipynb index b9358f9..a4e91c7 100644 --- a/notebooks/00-osmnx-features-demo.ipynb +++ b/notebooks/00-osmnx-features-demo.ipynb @@ -454,7 +454,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/01-overview-osmnx.ipynb b/notebooks/01-overview-osmnx.ipynb index b1c0de6..571353a 100644 --- a/notebooks/01-overview-osmnx.ipynb +++ b/notebooks/01-overview-osmnx.ipynb @@ -344,7 +344,7 @@ "outputs": [], "source": [ "# turn off strict mode and see what nodes we'd remove, in yellow\n", - "nc = [\"r\" if ox.simplification._is_endpoint(G, node, None) else \"y\" for node in G.nodes()]\n", + "nc = [\"r\" if ox.simplification._is_endpoint(G, node, None, None) else \"y\" for node in G.nodes()]\n", "fig, ax = ox.plot_graph(G, node_color=nc)" ] }, @@ -484,7 +484,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/04-simplify-graph-consolidate-nodes.ipynb b/notebooks/04-simplify-graph-consolidate-nodes.ipynb index 6ef55bb..6dd5362 100644 --- a/notebooks/04-simplify-graph-consolidate-nodes.ipynb +++ b/notebooks/04-simplify-graph-consolidate-nodes.ipynb @@ -149,7 +149,7 @@ "outputs": [], "source": [ "# show which nodes we'd remove if we simplify it (yellow)\n", - "nc = [\"r\" if ox.simplification._is_endpoint(G, node, None) else \"y\" for node in G.nodes()]\n", + "nc = [\"r\" if ox.simplification._is_endpoint(G, node, None, None) else \"y\" for node in G.nodes()]\n", "fig, ax = ox.plot_graph(G, node_color=nc)" ] }, @@ -182,7 +182,9 @@ "outputs": [], "source": [ "# turn off strict mode and see what nodes we'd remove\n", - "nc = [\"r\" if ox.simplification._is_endpoint(G, node, [\"osmid\"]) else \"y\" for node in G.nodes()]\n", + "nc = [\n", + " \"r\" if ox.simplification._is_endpoint(G, node, [\"osmid\"], None) else \"y\" for node in G.nodes()\n", + "]\n", "fig, ax = ox.plot_graph(G, node_color=nc)" ] }, @@ -233,7 +235,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, From f3979e7a27b591a0985b5e84c62a21de0a7a5581 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 16:10:09 -0700 Subject: [PATCH 6/7] add citation --- CITATION.cff | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..2325b44 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,21 @@ +cff-version: 1.2.0 +message: "If you use OSMnx, please cite the preferred-citation below." +title: "OSMnx Examples" +abstract: "Gallery of OSMnx tutorials, usage examples, and feature demonstations." +authors: +- family-names: "Boeing" + given-names: "Geoff" + orcid: "https://orcid.org/0000-0003-1851-6411" + website: "https://geoffboeing.com" +url: "https://osmnx.readthedocs.org" +repository-code: "https://github.com/gboeing/osmnx-examples" +preferred-citation: + type: report + title: "Modeling and Analyzing Urban Networks and Amenities with OSMnx" + authors: + - family-names: "Boeing" + given-names: "Geoff" + orcid: "https://orcid.org/0000-0003-1851-6411" + website: "https://geoffboeing.com" + year: 2024 + url: "https://geoffboeing.com/publications/osmnx-paper/" From c8147be2dec2cecf38522ac33c24aebfbf432a51 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Fri, 17 May 2024 16:10:22 -0700 Subject: [PATCH 7/7] update notebooks --- notebooks/10-building-footprints.ipynb | 12 ++++++------ notebooks/11-interactive-web-mapping.ipynb | 6 +++--- notebooks/12-node-elevations-edge-grades.ipynb | 6 +++--- notebooks/13-isolines-isochrones.ipynb | 6 +++--- notebooks/14-osmnx-to-igraph.ipynb | 6 +++--- notebooks/15-advanced-plotting.ipynb | 6 +++--- notebooks/16-download-osm-geospatial-features.ipynb | 6 +++--- notebooks/17-street-network-orientations.ipynb | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/notebooks/10-building-footprints.ipynb b/notebooks/10-building-footprints.ipynb index e573d7d..1a16032 100644 --- a/notebooks/10-building-footprints.ipynb +++ b/notebooks/10-building-footprints.ipynb @@ -71,7 +71,7 @@ "source": [ "# save as a GeoPackage\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\")" + "gdf_save.to_file(\"./data/piedmont_bldgs.gpkg\", driver=\"GPKG\")" ] }, { @@ -110,7 +110,7 @@ "source": [ "# get the total area within Piedmont's admin boundary in sq meters\n", "place = ox.geocode_to_gdf(\"Piedmont, California, USA\")\n", - "place_proj = ox.project_gdf(place)\n", + "place_proj = ox.projection.project_gdf(place)\n", "place_proj.area.iloc[0]" ] }, @@ -140,7 +140,7 @@ "point = (48.873446, 2.294255)\n", "dist = 612\n", "gdf = ox.features_from_point(point, tags, dist=dist)\n", - "gdf_proj = ox.project_gdf(gdf)\n", + "gdf_proj = ox.projection.project_gdf(gdf)\n", "bbox = ox.utils_geo.bbox_from_point(point=point, dist=dist, project_utm=True)\n", "fp = f\"./{img_folder}/paris_bldgs.{extension}\"\n", "fig, ax = ox.plot_footprints(\n", @@ -262,9 +262,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -276,7 +276,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/11-interactive-web-mapping.ipynb b/notebooks/11-interactive-web-mapping.ipynb index abcb80c..a88df0e 100644 --- a/notebooks/11-interactive-web-mapping.ipynb +++ b/notebooks/11-interactive-web-mapping.ipynb @@ -272,9 +272,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -286,7 +286,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/12-node-elevations-edge-grades.ipynb b/notebooks/12-node-elevations-edge-grades.ipynb index 2455675..3671b49 100644 --- a/notebooks/12-node-elevations-edge-grades.ipynb +++ b/notebooks/12-node-elevations-edge-grades.ipynb @@ -344,9 +344,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -358,7 +358,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/13-isolines-isochrones.ipynb b/notebooks/13-isolines-isochrones.ipynb index 4fbb305..87d0a00 100644 --- a/notebooks/13-isolines-isochrones.ipynb +++ b/notebooks/13-isolines-isochrones.ipynb @@ -234,9 +234,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -248,7 +248,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/14-osmnx-to-igraph.ipynb b/notebooks/14-osmnx-to-igraph.ipynb index 3ab739b..27a483d 100644 --- a/notebooks/14-osmnx-to-igraph.ipynb +++ b/notebooks/14-osmnx-to-igraph.ipynb @@ -209,9 +209,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -223,7 +223,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/15-advanced-plotting.ipynb b/notebooks/15-advanced-plotting.ipynb index 5262d37..d1fb7cb 100644 --- a/notebooks/15-advanced-plotting.ipynb +++ b/notebooks/15-advanced-plotting.ipynb @@ -316,9 +316,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -330,7 +330,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/16-download-osm-geospatial-features.ipynb b/notebooks/16-download-osm-geospatial-features.ipynb index 5c572de..cbae85b 100644 --- a/notebooks/16-download-osm-geospatial-features.ipynb +++ b/notebooks/16-download-osm-geospatial-features.ipynb @@ -123,9 +123,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -137,7 +137,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/notebooks/17-street-network-orientations.ipynb b/notebooks/17-street-network-orientations.ipynb index e55bb83..318f315 100644 --- a/notebooks/17-street-network-orientations.ipynb +++ b/notebooks/17-street-network-orientations.ipynb @@ -131,9 +131,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python (ox)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "ox" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -145,7 +145,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.9" + "version": "3.12.3" } }, "nbformat": 4,