GeoRegionsEcosystem / GeoRegions.jl

Defining Geographical Regions for Geoscience and Climate
https://georegionsecosystem.github.io/GeoRegions.jl/
MIT License
19 stars 3 forks source link

Use general GeoInterface polygons as PolyRegions #10

Open asinghvi17 opened 7 months ago

asinghvi17 commented 7 months ago

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.

asinghvi17 commented 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!

asinghvi17 commented 1 month ago

Another cool thing to do might be to implement the GeoInterface Feature interface for GeoRegions, so that Rasters.jl can easily consume them.

natgeo-wong commented 1 month ago

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.

asinghvi17 commented 1 month ago

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.

natgeo-wong commented 1 month ago

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.

asinghvi17 commented 1 month ago

Will PR if I end up doing this!