DahnJ / H3-Pandas

Integration of H3 with GeoPandas and Pandas
http://h3-pandas.readthedocs.io/
MIT License
207 stars 19 forks source link

Implement h3.compact and uncompact #30

Open KoalaGeo opened 9 months ago

KoalaGeo commented 9 months ago

Hi,

This library is great! Do you have plans to implement the H3 compact and uncompact functions?

Regards,

Edd

DahnJ commented 9 months ago

Hi @KoalaGeo glad you like the library!

Currently, I have no such plans.

What behaviour would you expect these functions to have in H3-Pandas?

compact and uncompact are set operations and applying them to a dataframe with potential additional data is not straightforward. I see two general options

  1. The data would have to be removed and the returned dataframe would be index-only. This would not be difficult to implement. I can see how that's still potentially convenient, as it allows you to string further h3 operations.
  2. The compacted/uncompacted cells would have to be matched back with the rows they originated from with some (dis)aggregation operation being performed on the data. k_ring_smoothing does something similar.

It would be helpful if you could elaborate on your usecase to drive the potential API.

KoalaGeo commented 9 months ago

I'm working with polygons, primarily categorical data (geology, rock type, formation name, descriptions etc).

I'm using polyfill / polyfill_resample, however it's resulting in massive numbers of polygons to accurately represent the input geometries - resolution 13 or 14 required.

I could do with the compact function at the end to simplify the data to fewer features using an index attribute eg rock type.