open-forest-observatory / geograypher

Multiview Semantic Reasoning with Geospatial Data
BSD 3-Clause "New" or "Revised" License
10 stars 4 forks source link

Accelerate polygon labeling #119

Closed russelldj closed 1 month ago

russelldj commented 1 month ago

Assigning per-polygon labels from per-face labels becomes a bottleneck for very large meshes. This introduces a couple optimizations. The first is to use a simplified ROI to crop the mesh to the region around the polygons, since this can get expensive using the full-resolution ROI. The second is add a derived method that breaks the polygons up into clusters and labels each cluster individually. This adds overhead, but decreases the number of mesh faces and polygons used in the expensive sjoin/overlay operation. So for very large meshes, it seems beneficial.

Finally, I added some caching to the code which computes the 2D geodata representation of the mesh faces. This allows it to be called multiple times with the same input and not recompute the data, which is useful for the batched/clustered implementation.

russelldj commented 1 month ago

I also added polygon labeling to the aggregation example notebook.