sen2r R包执行示例查询时出现saveXML方法匹配错误求助
使用sen2r R包加载哨兵影像时遇到
saveXML方法匹配错误 环境信息
- R版本:4.3.2
- sen2r版本:1.6.0
问题现象
运行sen2r官方文档提供的最简示例代码时失败,报错提示无法找到针对"NULL"签名的saveXML继承方法。
示例代码
json_path <- build_example_param_file() if (is_gcloud_configured()) { out_paths_2 <- sen2r(json_path) } else { out_paths_2 <- character(0) }
运行输出及错误信息
[2023-12-04 17:59:26] #### Starting sen2r execution. #### Spherical geometry (s2) switched off [2023-12-04 17:59:27] Searching for available SAFE products... old-style crs object detected; please recreate object with a recent sf::st_crs() old-style crs object detected; please recreate object with a recent sf::st_crs() [2023-12-04 17:59:28] Querying Google Cloud (this can take a very long time)... |==========================================================================================| 100%Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘saveXML’ for signature "NULL" Spherical geometry (s2) switched on
生成的默认参数JSON文件
{ "preprocess": [true], "s2_levels": ["l1c", "l2a"], "sel_sensor": ["s2a", "s2b"], "online": [true], "server": ["gcloud"], "order_lta": [true], "downloader": ["builtin"], "overwrite_safe": [false], "rm_safe": ["no"], "max_cloud_safe": [100], "step_atmcorr": ["l2a"], "sen2cor_use_dem": [null], "sen2cor_gipp": [null], "timewindow": ["2020-08-01", "2020-08-01"], "timeperiod": ["full"], "extent": ["C:/Users/pthom/AppData/Local/R/win-library/4.3/sen2r/extdata/vector/barbellino.geojson"], "s2tiles_selected": [null], "s2orbits_selected": [null], "list_prods": ["BOA", "SCL"], "list_indices": ["MSAVI2", "NDVI"], "list_rgb": ["RGB432B", "RGB843B"], "rgb_ranges": [ [0, 2500], [ [0, 7500], [0, 2500], [0, 2500] ] ], "index_source": ["BOA"], "mask_type": [null], "max_mask": [100], "mask_smooth": [0], "mask_buffer": [0], "clip_on_extent": [true], "extent_as_mask": [false], "extent_name": ["sen2r"], "reference_path": [null], "res": [null], "res_s2": ["10m"], "unit": ["Meter"], "proj": [null], "resampling": ["near"], "resampling_scl": ["near"], "outformat": ["GTiff"], "rgb_outformat": ["GTiff"], "index_datatype": ["Int16"], "compression": ["DEFLATE"], "rgb_compression": ["DEFLATE"], "overwrite": [false], "path_l1c": ["C:/Users/pthom/DOCUME~1/SEN2R~1/safe"], "path_l2a": ["C:/Users/pthom/DOCUME~1/SEN2R~1/safe"], "path_tiles": [null], "path_merged": [null], "path_out": ["C:\\Users\\pthom\\AppData\\Local\\Temp\\RtmpyAjAd3\\sen2r_out_120814e04eb2"], "path_rgb": [""], "path_indices": [""], "path_subdirs": [true], "thumbnails": [true], "log": [null], "parallel": [false], "processing_order": ["by_groups"], "pkg_version": ["1.6.0"] }
空间范围GeoJSON文件内容
{ "type": "FeatureCollection", "name": "barbellino", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32632" } }, "features": [ { "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 580560.0, 5101700.0 ], [ 580680.0, 5101700.0 ], [ 580800.0, 5101820.0 ], [ 580800.0, 5102120.0 ], [ 580660.0, 5102120.0 ], [ 580560.0, 5102020.0 ], [ 580560.0, 5101700.0 ] ] ] } } ] }
已尝试的解决措施
- 更新所有已安装的R包
- 通过
devtools::install_github("ranghetti/sen2r")安装sen2r的GitHub最新版本 - 查阅相关问题但未找到有效解决方案
寻求可行的解决方法以修复该saveXML方法匹配错误,使示例代码正常运行。
内容的提问来源于stack exchange,提问作者Peter Thompson
相关产品推荐
相关产品推荐

