From 850e2411471895bebbb7c0ffaf74b0d91713c40b Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 25 Dec 2023 13:13:54 -0700 Subject: [PATCH 1/5] version bump and dates --- LICENSE.txt | 2 +- docs/source/conf.py | 2 +- osmnx/_version.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index cc6a4272b..032ddc1e6 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016-2023 Geoff Boeing https://geoffboeing.com/ +Copyright (c) 2016-2024 Geoff Boeing https://geoffboeing.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/source/conf.py b/docs/source/conf.py index 465470fa1..bae5ef5ce 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -15,7 +15,7 @@ sys.path.insert(0, pkg_root_path) author = "Geoff Boeing" -copyright = "2016-2023, Geoff Boeing" # noqa: A001 +copyright = "2016-2024, Geoff Boeing" # noqa: A001 project = "OSMnx" # dynamically load version from /osmnx/_version.py diff --git a/osmnx/_version.py b/osmnx/_version.py index 80a90c67e..2108ae46f 100644 --- a/osmnx/_version.py +++ b/osmnx/_version.py @@ -1,3 +1,3 @@ """OSMnx package version information.""" -__version__ = "1.8.0" +__version__ = "1.8.1" From fc2dbc2a9aeba2db50596d14d2ca2fa47e65d07d Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Mon, 25 Dec 2023 13:15:54 -0700 Subject: [PATCH 2/5] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a70bd5e15..f93dd49c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 1.8.1 (2023-12-31) - fix a bug arising from the save_graph_xml function (#1093) - warn user if their query area is significantly larger than max query area size (#1101) From e51d11635f7848982ac9c41a796629237f1ab380 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Thu, 28 Dec 2023 12:47:34 -0700 Subject: [PATCH 3/5] make docstring and var name more descriptive --- osmnx/utils_geo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osmnx/utils_geo.py b/osmnx/utils_geo.py index 29c421120..1a1fb52ff 100644 --- a/osmnx/utils_geo.py +++ b/osmnx/utils_geo.py @@ -387,10 +387,10 @@ def _intersect_index_quadrats(geometries, polygon): def bbox_from_point(point, dist=1000, project_utm=False, return_crs=False): """ - Create a bounding box from a (lat, lon) center point. + Create a bounding box around a (lat, lon) point. - Create a bounding box some distance in each direction (north, south, east, - and west) from the center point and optionally project it. + Create a bounding box some distance (in meters) in each direction (north, + south, east, and west) from the center point and optionally project it. Parameters ---------- @@ -408,11 +408,11 @@ def bbox_from_point(point, dist=1000, project_utm=False, return_crs=False): tuple (north, south, east, west) or (north, south, east, west, crs_proj) """ - EARTH_RADIUS = 6_371_009 # meters + EARTH_RADIUS_M = 6_371_009 # meters lat, lon = point - delta_lat = (dist / EARTH_RADIUS) * (180 / np.pi) - delta_lon = (dist / EARTH_RADIUS) * (180 / np.pi) / np.cos(lat * np.pi / 180) + delta_lat = (dist / EARTH_RADIUS_M) * (180 / np.pi) + delta_lon = (dist / EARTH_RADIUS_M) * (180 / np.pi) / np.cos(lat * np.pi / 180) north = lat + delta_lat south = lat - delta_lat east = lon + delta_lon From 25a0d5d8423813727ba1ff00d845ea9e673d1398 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Thu, 28 Dec 2023 13:05:34 -0700 Subject: [PATCH 4/5] improve docstring --- osmnx/utils_geo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osmnx/utils_geo.py b/osmnx/utils_geo.py index 1a1fb52ff..2df9ea036 100644 --- a/osmnx/utils_geo.py +++ b/osmnx/utils_geo.py @@ -64,12 +64,12 @@ def interpolate_points(geom, dist): a LineString geometry dist : float spacing distance between interpolated points, in same units as `geom`. - smaller values generate more points. + smaller values accordingly generate more points. Yields ------ - point : tuple of floats - a generator of (x, y) tuples of the interpolated points' coordinates + points : generator + tuples of (x, y) floats of the interpolated points' coordinates """ if isinstance(geom, LineString): num_vert = max(round(geom.length / dist), 1) From 15b9a27f90c8b443839dc21a9883b33afc13f7f4 Mon Sep 17 00:00:00 2001 From: Geoff Boeing Date: Thu, 28 Dec 2023 13:28:54 -0700 Subject: [PATCH 5/5] improve docstring and var names descriptiveness --- osmnx/utils_geo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osmnx/utils_geo.py b/osmnx/utils_geo.py index 2df9ea036..ef3c2d130 100644 --- a/osmnx/utils_geo.py +++ b/osmnx/utils_geo.py @@ -340,7 +340,7 @@ def _quadrat_cut_geometry(geometry, quadrat_width): def _intersect_index_quadrats(geometries, polygon): """ - Identify geometries that intersect a (multi)polygon. + Identify geometries that intersect a (Multi)Polygon. Uses an r-tree spatial index and cuts polygon up into smaller sub-polygons for r-tree acceleration. Ensure that geometries and polygon are in the @@ -356,11 +356,11 @@ def _intersect_index_quadrats(geometries, polygon): Returns ------- geoms_in_poly : set - index labels of geometries that intersected polygon + set of the index labels of the geometries that intersected the polygon """ # create an r-tree spatial index for the geometries - sindex = geometries.sindex - utils.log(f"Created r-tree spatial index for {len(geometries):,} geometries") + rtree = geometries.sindex + utils.log(f"Built r-tree spatial index for {len(geometries):,} geometries") # cut polygon into chunks for faster spatial index intersecting. specify a # sensible quadrat_width to balance performance (eg, 0.1 degrees is approx @@ -376,7 +376,7 @@ def _intersect_index_quadrats(geometries, polygon): for poly in multipoly.geoms: poly_buff = poly.buffer(0) if poly_buff.is_valid and poly_buff.area > 0: - possible_matches_iloc = sindex.intersection(poly_buff.bounds) + possible_matches_iloc = rtree.intersection(poly_buff.bounds) possible_matches = geometries.iloc[list(possible_matches_iloc)] precise_matches = possible_matches[possible_matches.intersects(poly_buff)] geoms_in_poly.update(precise_matches.index)