From e12f96cb5d4e9db8d57439dff8143dfbcafa0bcc Mon Sep 17 00:00:00 2001 From: jeronimol Date: Thu, 1 Aug 2024 17:18:25 -0400 Subject: [PATCH] Added progress bar using rich.progress track to geom.py --- urbanpy/geom/geom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/urbanpy/geom/geom.py b/urbanpy/geom/geom.py index f1e62a4..05d1a3d 100644 --- a/urbanpy/geom/geom.py +++ b/urbanpy/geom/geom.py @@ -165,7 +165,8 @@ def gen_hexagons(resolution: int, city: gpd.GeoDataFrame) -> gpd.GeoDataFrame: # Get every polygon in Multipolygon shape city_poly = city.explode(index_parts=True).reset_index(drop=True) - for _, geo in city_poly.iterrows(): + total = len(city_poly) # For rich library to how much progress is needed + for _, geo in track(city_poly.iterrows(), total=total): hexagons = h3.polyfill( geo["geometry"].__geo_interface__, res=resolution, geo_json_conformant=True )