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.
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.