使用R语言rsat包下载Sentinel 2时遇"espa_orders缺失"错误求助
使用rsat包下载Sentinel-2数据时遇到
espa_orders参数缺失错误 问题描述
在R中使用rsat包调用哥白尼数据空间Web服务API下载Sentinel-2数据,创建感兴趣区域的new_rtoi()、搜索数据的rsat_search()功能正常,但调用rsat_download()时触发错误:
Ordering on ESPA platform...
Error in (new("refMethodDef", .Data = function (espa_orders, db_path, :
argument "espa_orders" is missing, with no default
查阅rsat_download()函数文档,确认该函数并未定义espa_orders参数,推测是包内部函数的参数传递bug。
可复现代码
library(rsat) library(terra) library(sf) library(tmap) library(tmaptools) xmin<-538078.1 xmax<-866945.5 ymin<-773531.3 ymax<-1436377.3 AOI_ext<-ext(xmin, xmax, ymin, ymax) AOI<-AOI_ext %>% st_bbox() %>% st_as_sfc() %>% st_as_sf(crs=6557) tmap_mode("view") tm_shape(AOI)+ tm_polygons(border.col="magenta", alpha=0, col=NA, lwd=2)+ tm_basemap(server = providers$Esri.WorldImagery) toi<-as.Date("2023-04-27") db.path <- file.path(tempdir(),"database_test") ds.path <- file.path(tempdir(),"datasets_test") if(!dir.exists(db.path)){ dir.create(db.path) } if(!dir.exists(ds.path)){ dir.create(ds.path) } April<-new_rtoi(name="April_test2", region=AOI, db_path=db.path, rtoi_path = ds_path) searchit<-rsat_search(region=April, product="S2MSI1C", dates=toi) rsat_download(searchit, db_path=db.path)
解决思路
- 更新rsat包到最新版本:该bug可能已在后续版本中修复,运行
update.packages("rsat")更新后重试 - 关闭ESPA预处理流程:若仅需原始S2MSI1C数据,尝试在
rsat_download()中添加espa = FALSE参数,绕过ESPA相关的内部逻辑:rsat_download(searchit, db_path = db.path, espa = FALSE) - 替换工具包:若上述方法无效,可改用
sen2r、gdalcubes等成熟的Sentinel数据下载工具包完成任务
内容的提问来源于stack exchange,提问作者Sean McKenzie
相关产品推荐
相关产品推荐

