The current burn_vector_geometry relies on calling earcut to break a polygon down into a triangular mesh, which is then checked for overlap. I don't necessarily see a better way for all_touched=True since it relies on computing overlaps. But in case of all_touched=False, it's just searching for centroids.
In this case, it's just a point in polygon check. The ad hoc benchmarking seemed to show that is was beating geopandas points-in-polygon, but not massively so (something like one order of magnitude).
They do some prior work so it should be more efficient to search collections of points. It would be worthwhile to investigate, although it should maybe end up in numba-celltree instead.
The current
burn_vector_geometry
relies on calling earcut to break a polygon down into a triangular mesh, which is then checked for overlap. I don't necessarily see a better way forall_touched=True
since it relies on computing overlaps. But in case ofall_touched=False
, it's just searching for centroids.In this case, it's just a point in polygon check. The ad hoc benchmarking seemed to show that is was beating geopandas points-in-polygon, but not massively so (something like one order of magnitude).
I came across these two:
https://github.com/dengwirda/inpoly https://github.com/KlausC/PolygonInbounds.jl
They do some prior work so it should be more efficient to search collections of points. It would be worthwhile to investigate, although it should maybe end up in numba-celltree instead.