Closed cboettig closed 1 year ago
Thanks, it seems that instead of datetime
, the returned STAC items contain start_endtime
and end_datetime
properties, while stac_image_collection()
expects the former.
The following workaround works for me:
features_new = lapply(matches$features, function(x) {
x$properties$datetime = x$properties$start_datetime
return(x)
})
cube <- gdalcubes::stac_image_collection(features_new, asset_names = "Lai_500m")
cube
Not sure if this is compliant with the STAC specification. To me it seems that datetime
is required (see https://github.com/radiantearth/stac-spec/blob/fd8fb4e3cf0b6c4a0fe74822accbc1725a92f92a/item-spec/json-schema/item.json#L136). Can you help, @m-mohr?
datetime
is allowed to be null if start_datetime
and end_datetime
are given. If a single datetime is required, people sometimes compute a center datetime or just use the start_datetime. It depends on the use-case which procedure is ideal.
https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#datetime
Great, thanks for clarifying! I'll adapt stac_image_collection()
accordingly. However, adding full support for images with datetime intervals when creating data cubes (other than just using the start / center datetime) might need some additional work.
Thanks both! @appelmar I think it would be fine to fill with the center datetime or start_datetime in most cases. Maybe an optional argument to toggle this, something like duration = c("start", "center", NA)
perhaps?
Thanks for the suggestion, this is now implemented with default being "center".
awesome! Works great, thanks.
Thanks for this amazing package, the ability to create a virtual cube directly from a STAC search seems very powerful. Unfortunately I'm having a bit of trouble with the following example, but cannot spot where stac_image_collection() is getting snagged up.