rstac
rstac copied to clipboard
Error in rstac::stac() Value '' is not a valid property name
I was following along the code in https://stacspec.org/en/tutorials/2-using-rstac-and-cql2-to-query-stac-api/ and it seems that this part is not running:
rstac::stac("https://planetarycomputer.microsoft.com/api/stac/v1") |>
rstac::ext_filter(
collection == "landsat-c2-l2" &&
t_intersects(datetime, )
)
Not sure I'm doing something wrong or if it is a bug
Complete code :
require(sf)
require(rstac)
ashe <- sf::read_sf(system.file("shape/nc.shp", package = "sf"))[1, ]
ashe_bbox <- ashe |>
sf::st_transform(4326) |>
sf::st_bbox()
stac_query <- rstac::stac(
"https://planetarycomputer.microsoft.com/api/stac/v1"
) |>
rstac::stac_search(
collections = "landsat-c2-l2",
bbox = ashe_bbox,
datetime = "2021-01-01/2021-01-31"
) |>
rstac::get_request()
#stac_query
lapply(stac_query$features, \(x) names(x$properties)) |>
unlist() |>
unique()
lapply(
stac_query$features,
\(x) data.frame(id = x$id, platform = x$properties$platform)
) |>
do.call(what = rbind)
ashe_bbox_geojson <- rstac::cql2_bbox_as_geojson(ashe_bbox)
#ashe_bbox_geojson
time_range <- rstac::cql2_interval("2021-01-01", "2021-01-31")
#time_range
rstac::stac("https://planetarycomputer.microsoft.com/api/stac/v1") |>
rstac::ext_filter(
collection == "landsat-c2-l2"
)
rstac::stac("https://planetarycomputer.microsoft.com/api/stac/v1") |>
rstac::ext_filter(
collection == "landsat-c2-l2" &&
t_intersects(datetime, )
)
Error: Value '' is not a valid property name