pysal / tobler

Spatial interpolation, Dasymetric Mapping, & Change of Support
https://pysal.org/tobler
BSD 3-Clause "New" or "Revised" License
144 stars 30 forks source link

H3fy concats pandas dataframes for each polygon in source_unary #163

Closed jtmiclat closed 2 years ago

jtmiclat commented 2 years ago

Hi was looking h3fy implementation and I found the following lines https://github.com/pysal/tobler/blob/66f3825594cf5a3b00ca351b9356cedea5884b86/tobler/util/util.py#L97-L102

It runs pd.concat for each polygon in source_unary. It should probably run pd.concat only once and outside the for loop like

        output = []
        for geom in source_unary.geoms:
            hexes = _to_hex(geom, resolution=resolution, return_geoms=return_geoms)
            output.append(hexes)
        hexagons = pandas.concat(output) # unindent
knaaptime commented 2 years ago

good catch, thanks!