Closed VincentVerelst closed 1 month ago
@kvantricht , quite some changes since your last review:
With the new changes made around authentication, a way to interact with the RDM API would now be as follows:
from worldcereal.rdm_api import RdmInteraction
interaction = RdmInteraction().authenticate()
gdf = interaction.query_rdm(geometry=multi_polygon, temporal_extent=temporal_extent)
Authentication now works similary to the OpenEO Python Client. You can also leave out authenticate()
, in which case the rdm query will only interact with public datasets.
For a STAC collection of patch extractions, you can extract the geometries of all patchtes into one MultiPolygon
as follows (the following code will probably become part of the patch-to-points extraction script):
import pystac
from shapely.geometry import shape, MultiPolygon
collection = pystac.read_file('/path/to/stac/collection.json')
polygons = []
for item in collection.get_items():
polygons.append(shape(item.geometry).buffer(1e-9)) # Add buffer to avoid TopologyException
multi_polygon = MultiPolygon(polygons)
temporal_extent = [collection.extent.temporal.intervals[0][0], collection.extent.temporal.intervals[0][1]]
The results for a query on this MultiPolygon and temporal_extent look like this (cached 64x64 patches in pink, RDM query results in purple):
@kvantricht, added some resilience and a timeout to the RDM interaction. That should cover your final comments!
Perfect, thanks!
This is a first version of how we can construct a GeoParquet file from the RDM API, based on a user-defined AOI.
How it works:
A visualization of the output:
All feedback is welcome!