Closed malenacandino closed 3 years ago
I suspect it could be similar to this one: https://github.com/ranghetti/sen2r/issues/360.
Nevertheless, to deepen your case I need to be able to reproduce it. When you opened this issue you should have noticed (and deleted) a template: please fill that template with the required information, so I will be able to debug it.
Issue description
I get a warning saying my features lie outside standard longitude bounds (-180 to 180) which is likely to cause trouble later!! Data downloads but doesn't seem to be correctly projected and I can't use it with the MODIStsp_extract function
(this is what my json contains- not sure if I should add the link- also attaching a shapefile of the polygon I was drawing )
selcat | "Ecosystem Variables - Vegetation Indices" |
---|---|
selprod | "Vegetation Indexes_16Days_250m (M*D13Q1)" |
prod_version | "6" |
sensor | "Both" |
bandsel | |
0 | "NDVI" |
1 | "VI_QA" |
2 | "DOY" |
3 | "Rely" |
quality_bandsel | |
0 | "QA_qual" |
1 | "QA_snow_ice" |
indexes_bandsel | null |
download_server | "http" |
user | "*****" |
password | "***" |
downloader | "http" |
download_range | "Full" |
start_date | "2019.05.01" |
end_date | "2020.07.15" |
spatmeth | "map" |
start_x | 13 |
end_x | 13 |
start_y | 13 |
end_y | 13 |
bbox | |
0 | -431.6089 |
1 | -47.4546 |
2 | -430.7217 |
3 | -46.7799 |
spafile | null |
drawnext | "{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"X_leaflet_id\": 1843,\n \"layerId\": \"1843\",\n \"edit_id\": \"1843\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [-431.004639, -46.78743],\n [-431.372681, -46.779907],\n [-431.595154, -46.986405],\n [-431.608887, -47.244342],\n [-431.438599, -47.400735],\n [-431.235352, -47.454621],\n [-430.916748, -47.428614],\n [-430.732727, -47.343072],\n [-430.721741, -47.143559],\n [-431.004639, -46.78743]\n ]\n ]\n }\n }\n ]\n}" |
out_projsel | "User Defined" |
output_proj | "EPSG: 4326 - WGS 84" |
out_res_sel | "Native" |
out_res | 231.6564 |
resampling | "near" |
reprocess | false |
delete_hdf | true |
nodata_change | false |
scale_val | false |
out_format | "GTiff" |
ts_format | "R RasterStack" |
compress | "LZW" |
out_folder | "/Users/malenacandino/Desktop/Guanacos metadata/NDVI downloads" |
out_folder_mod | "/Users/malenacandino/Downloads" |
MODIStspVersion | "2.0.5" |
I also tried doing it with a scritp in r, but got this error: Error in bbox_from_file(spafile, crs_out = proc_opts$output_proj) : Specified file path does not exist. Aborting!
## PLEASE DELETE AND WRITE YOUR OWN
library(MODIStsp)
studyarea<-system.file("/Users/malenacandino/Desktop/Guanacos metadata/study_area.shp", package = "MODIStsp")
MODIStsp(gui= FALSE,
out_folder = '/Users/malenacandino/Desktop/Guanacos metadata/MODIStsp',
selprod = "Vegetation Indexes_16Days_250m (M*D13Q1)",
bandsel = "NDVI",
spatmeth = "file",
spafile = studyarea,
out_projsel = "User Defined",
output_proj = "EPGS:4326",
user = "******",
password = "********",
start_date = "2019-05-01",
end_date = "2020-07-15",
verbose = FALSE)
Expected and actual behavior
## PASTE HERE THE OUTPUT OF YOUR EXAMPLE CODE
System information
I get a warning saying my features lie outside standard longitude bounds (-180 to 180) which is likely to cause trouble later!! Data downloads but doesn't seem to be correctly projected and I can't use it with the MODIStsp_extract function
(this is what my json contains- not sure if I should add the link- also attaching a shapefile of the polygon I was drawing )
selcat | "Ecosystem Variables - Vegetation Indices" |
---|---|
selprod | "Vegetation Indexes_16Days_250m (M*D13Q1)" |
prod_version | "6" |
sensor | "Both" |
bandsel | |
0 | "NDVI" |
1 | "VI_QA" |
2 | "DOY" |
3 | "Rely" |
quality_bandsel | |
0 | "QA_qual" |
1 | "QA_snow_ice" |
indexes_bandsel | null |
download_server | "http" |
user | "*****" |
password | "***" |
downloader | "http" |
download_range | "Full" |
start_date | "2019.05.01" |
end_date | "2020.07.15" |
spatmeth | "map" |
start_x | 13 |
end_x | 13 |
start_y | 13 |
end_y | 13 |
bbox | |
0 | -431.6089 |
1 | -47.4546 |
2 | -430.7217 |
3 | -46.7799 |
spafile | null |
drawnext | "{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"properties\": {\n \"X_leaflet_id\": 1843,\n \"layerId\": \"1843\",\n \"edit_id\": \"1843\"\n },\n \"geometry\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [-431.004639, -46.78743],\n [-431.372681, -46.779907],\n [-431.595154, -46.986405],\n [-431.608887, -47.244342],\n [-431.438599, -47.400735],\n [-431.235352, -47.454621],\n [-430.916748, -47.428614],\n [-430.732727, -47.343072],\n [-430.721741, -47.143559],\n [-431.004639, -46.78743]\n ]\n ]\n }\n }\n ]\n}" |
out_projsel | "User Defined" |
output_proj | "EPSG: 4326 - WGS 84" |
out_res_sel | "Native" |
out_res | 231.6564 |
resampling | "near" |
reprocess | false |
delete_hdf | true |
nodata_change | false |
scale_val | false |
out_format | "GTiff" |
ts_format | "R RasterStack" |
compress | "LZW" |
out_folder | "/Users/malenacandino/Desktop/Guanacos metadata/NDVI downloads" |
out_folder_mod | "/Users/malenacandino/Downloads" |
MODIStspVersion | "2.0.5" |
I also tried doing it with a scritp in r, but got this error: Error in bbox_from_file(spafile, crs_out = proc_opts$output_proj) : Specified file path does not exist. Aborting!
## PLEASE DELETE AND WRITE YOUR OWN
library(MODIStsp)
studyarea<-system.file("/Users/malenacandino/Desktop/Guanacos metadata/study_area.shp", package = "MODIStsp")
MODIStsp(gui= FALSE,
out_folder = '/Users/malenacandino/Desktop/Guanacos metadata/MODIStsp',
selprod = "Vegetation Indexes_16Days_250m (M*D13Q1)",
bandsel = "NDVI",
spatmeth = "file",
spafile = studyarea,
out_projsel = "User Defined",
output_proj = "EPGS:4326",
user = "******",
password = "********",
start_date = "2019-05-01",
end_date = "2020-07-15",
verbose = FALSE)
Expected and actual behavior
## PASTE HERE THE OUTPUT OF YOUR EXAMPLE CODE
System information
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sf_0.9-7 sp_1.4-4 MODIStsp_2.0.5 magrittr_2.0.1 mapedit_0.6.0
[6] leafem_0.1.3 shinyjs_2.0.0 rappdirs_0.3.1 shinyalert_2.0.0 shinyFiles_0.9.0
[11] shinydashboard_0.7.1 shiny_1.5.0 leaflet_2.0.4.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 lattice_0.20-41 png_0.1-7 class_7.3-17 zoo_1.8-8
[6] V8_3.4.0 assertthat_0.2.1 digest_0.6.27 mime_0.9 R6_2.5.0
[11] e1071_1.7-4 geojson_0.3.4 httr_1.4.2 pillar_1.4.7 rlang_0.4.10
[16] uuid_0.1-4 lazyeval_0.2.2 curl_4.3 rstudioapi_0.13 data.table_1.13.6
[21] raster_3.4-5 geojsonio_0.9.2 rgdal_1.5-19 foreign_0.8-81 jqr_1.2.0
[26] stringr_1.4.0 htmlwidgets_1.5.3 compiler_4.0.3 httpuv_1.5.4 pkgconfig_2.0.3
[31] base64enc_0.1-3 leafpm_0.1.0 rgeos_0.5-5 htmltools_0.5.0 gdalUtilities_1.1.1
[36] tidyselect_1.1.0 httpcode_0.3.0 tibble_3.0.4 codetools_0.2-18 crayon_1.3.4
[41] dplyr_1.0.2 later_1.1.0.1 bitops_1.0-6 crul_1.0.0 grid_4.0.3
[46] jsonlite_1.7.2 xtable_1.8-4 lifecycle_0.2.0 DBI_1.1.0 units_0.6-7
[51] KernSmooth_2.23-18 stringi_1.5.3 fs_1.5.0 promises_1.1.1 xml2_1.3.2
[56] ellipsis_0.3.1 xts_0.12.1 generics_0.1.0 vctrs_0.3.6 tools_4.0.3
[61] glue_1.4.2 purrr_0.3.4 crosstalk_1.1.0.1 parallel_4.0.3 fastmap_1.0.1
[66] yaml_2.2.1 maptools_1.0-2 classInt_0.4-3
packageVersion("MODIStsp")
[1] ‘2.0.5’
I cannot test it now because the NASA server is currently down. I will retry in the next days.
There was a bug appearing when the user loads a previously saved JSON parameter file, in which the extent was provided by drawing it on the map. Commit a73c02b2c70c581f377b26368a5b3ab9611ddba9 should have fixed it.
Moreover, the bounding box provided in the JSON file is wrong (longitudes are out of range, probably because the extent was drawn after surfing the planisphere on the left).
Please try in this way:
install.packages("remotes")
remotes::install_github("ropensci/MODIStsp", ref = "devel")
"bbox": [-431.6089, -47.4546, -430.7217, -46.7799],
with
"bbox": [-71.6089, -47.4546, -70.7217, -46.7799],
@malenacandino, have you tried with the previous suggestions? Please let me know,
Hi, I'm trying to use MODIStsp to download NDVI layers to conduct a resource selection function analysis. I'm using the GUI, choosing the output projection to be "EPSG:4326 - WGS 84" and after drawing a polygon in the map and trying to download the data, I got this warning:
Warning: drawn features lie outside standard longitude bounds (-180 to 180) which is likely to cause trouble later!! Warning:
select_()
is deprecated as of dplyr 0.7.0. Please useselect()
instead.The data still downloaded, but when I tried accessing it in QGIS, it wasn't located where it should have been, and when I tried to use MODIStsp_extract using a sf object with long-lat point coordinates, I got this:
although coordinates are longitude/latitude, st_intersection assumes that they are planar Error in
[<-
(*tmp*
, f, 1:ncols, value = rDT[, lapply(.SD, match.fun(FUN), : subscript out of bounds In addition: Warning messages: 1: attribute variables are assumed to be spatially constant throughout all geometries 2: In MODIStsp_extract(inrts, sf, startdate, enddate, FUN = "mean", : Some features of the spatial object are outside or partially outside the extent of the input RasterStack ! Output for features outside RasterStack extent will be set to NA. Outputs for features only partially inside will be retrieved using only the available pixels ! 3: In abbreviate_shapefile_names(obj) : Field names abbreviated for ESRI Shapefile driver 4: In CPL_write_ogr(obj, dsn, layer, driver, as.character(dataset_options), : GDAL Error 1: /var/folders/ys/4qykjzr149zfdqhbq49wx9vr0000gn/T//RtmpUH7Yq2/file13eb35e17bb99.shp does not appear to be a file or directory. 5: In max(shape$mdxtnq) : no non-missing arguments to max; returning -InfI tried downloading the data again usint the "tiles" option, in case there was something wrong with the polygon I drew on the map, but got a similar warning:
Warning in sf::st_is_longlat(x) : bounding box has potentially an invalid value range for longlat data
Not sure what the problem is and how to troubleshoot it.