Skip to content

Commit

Permalink
Added progress bar using rich.progress track to geom.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeronimoluza committed Aug 1, 2024
1 parent 076330f commit e12f96c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion urbanpy/geom/geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit e12f96c

Please sign in to comment.