Open asinghvi17 opened 7 months ago
Ah I see you already use PolygonOps - that's the same algorithm which GeometryBasics uses. I think we got the code from there!
Another cool thing to do might be to implement the GeoInterface Feature interface for GeoRegions, so that Rasters.jl can easily consume them.
Could you link to the documentation on this? I'm very close to publishing v7
, so this will probably go into v7.1
or v8
.
https://juliageo.org/GeoInterface.jl/dev/guides/developer/#Required-for-Feature(Collection)s
and you could just return a NamedTuple with all relevant attributes as the result of GI.properties(::GeoRegion)
, as well as the underlying GeometryBasics.Polygon as the result of GI.geometry(::GeoRegion)
. Maybe consider defining e.g. GI.crs
as well?
This would also give a standard interface to get "a polygon" from a georegion, where rectregions could construct the polygon on the fly and return it in GI.geometry
. Same for tilted regions, I imagine.
GeoRegions will construct the polygon automatically when the GeoRegion information is retrieved.
But are you asking if I can integrate and extend GI.properties
and other things, that I can do eventually.
Will PR if I end up doing this!
This would only require GeoInterface support, and would allow people to use predefined polygons a lot more easily, plus add support for holes in regions!
If you need a nice point in polygon test, Rasters.jl and GeometryOps.jl have some good implementations.