rstac icon indicating copy to clipboard operation
rstac copied to clipboard

HTTP content error when using ext_filter + post_request

Open kaibagley opened this issue 9 months ago • 0 comments

Describe the bug Getting the following error:

HTTP content type response 'text/html' not defined for this operation

To Reproduce sf_obj is an sf object containing polygons.

dea_stac_endpoint <- "https://explorer.dea.ga.gov.au/stac"
date_start <- "2023-01-01"
date_end <- "2023-02-01"

bbox <- rstac::cql2_bbox_as_geojson(st_bbox(sf_obj))
time_range <- rstac::cql2_interval(date_start, date_end)

query <-
        rstac::stac(dea_stac_endpoint) |>
        rstac::ext_filter(
                   collection == "ga_s2bm_ard_3" &&
                   s_intersects(geometry, {{bbox}}) &&
                   t_intersects(datetime, {{time_range}}) &&
                   `eo:cloud_cover` < 20
               ) |>
        rstac::post_request()

Additional context I can retrieve the images I want using stac_search + get_request + assets_url etc., however I need to specify the cloud cover, which I cannot see how to do in stac_search

R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.utf8 LC_CTYPE=English_Australia.utf8
[3] LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C
[5] LC_TIME=English_Australia.utf8

time zone: Australia/Perth tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] tmap_3.3-4 sf_1.0-14 magrittr_2.0.3 httpgd_1.3.1 crayon_1.5.2

loaded via a namespace (and not attached): [1] raster_3.6-26 htmlwidgets_1.6.4 lattice_0.22-5 vctrs_0.6.4 tools_4.3.2
[6] crosstalk_1.2.1 generics_0.1.3 curl_5.2.1 parallel_4.3.2 tibble_3.2.1
[11] proxy_0.4-27 fansi_1.0.5 pacman_0.5.1 pkgconfig_2.0.3 KernSmooth_2.23-22 [16] RColorBrewer_1.1-3 leaflet_2.2.2 lifecycle_1.0.4 compiler_4.3.2 terra_1.7-55
[21] codetools_0.2-19 leafsync_0.1.0 ncdf4_1.22 stars_0.6-5 htmltools_0.5.7
[26] usethis_2.2.3 rstac_1.0.0 class_7.3-22 later_1.3.1 pillar_1.9.0
[31] classInt_0.4-10 lwgeom_0.2-13 abind_1.4-5 tidyselect_1.2.1 digest_0.6.33
[36] dplyr_1.1.3 purrr_1.0.2 rprojroot_2.0.4 fastmap_1.1.1 grid_4.3.2
[41] cli_3.6.1 base64enc_0.1-3 dichromat_2.0-0.1 XML_3.99-0.14 utf8_1.2.4
[46] leafem_0.2.3 e1071_1.7-13 sp_2.1-1 httr_1.4.7 jpeg_0.1-10
[51] gdalcubes_0.7.0 png_0.1-8 tmaptools_3.1-1 viridisLite_0.4.2 rlang_1.1.2
[56] Rcpp_1.0.11 glue_1.6.2 DBI_1.2.2 rstudioapi_0.16.0 jsonlite_1.8.8
[61] R6_2.5.1 systemfonts_1.0.5 fs_1.6.3 units_0.8-4

kaibagley avatar May 24 '24 08:05 kaibagley