You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 text was updated successfully, but these errors were encountered:
The 10x speed up compared to geopandas is not that impressive -- I guess because it's building an intermediate celltree for the earcut polygons.
However, that tree could be re-used in case multiple operations are required for a polygon dataset. This a pretty convincing argument to add an earcut staticmethod which returns a UgridDataArray with the earcut topology as the mesh, and returns the polygon indices as the data.
This also gives a clean composing way of implementing: #234
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.
The text was updated successfully, but these errors were encountered: