Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot download Landsat8 images through RGISTools R package #8

Open
caio-valente14 opened this issue Feb 4, 2021 · 5 comments
Open

Comments

@caio-valente14
Copy link

I've been having a hard time trying to automate some Landsat 8 image download and processing for my project.


At first, I tried to use getSpatialData package to do what I need from R, but it seems the authors aren't maintaining and supporting the library recently.


Now, I'm trying to acomplish my goals by using RGISTools package, but I'm reading the article the authors wrote about the package and testing in real time here in Rstudio and when I try to run some functions like lsDownload(), and it keeps returning an error:


Downloading the images in: C:/PROJETOS_PRINCIPAIS2/AUTOMATE_SATELITE_IMAGE/RGISTools/Teste/landsat8/downloads/Landsat8/raw

Starting Landsat level 1 download process...

Error in charToRaw(enc2utf8(val)) :

  argument must be a character vector of length 1

Here is my code for you to take a look if I'm missing something:

##### Import libraries #####

library(raster)

library(sp)

library(sf)

library(RGISTools)

##### Set the working directory #####

scriptWD <- 'C:/PROJETOS_PRINCIPAIS2/AUTOMATE_SATELITE_IMAGE/RGISTools/Teste'

setwd(scriptWD)

##### Import area of interest #####

hortoMG <- st_read('mogiGuacu.shp')

##### Searching for images #####

search <- lsSearch(AppRoot = scriptWD,

                    product = 'LANDSAT_8_C1',

                    dates = as.Date('2020-07-01') + seq(0, 15, 1),

                    region = hortoMG,

                    cloudCover = c(0, 80),

                    username = '*****',

                    password = '*****')


##### Search Preview #####

lsPreview(searchres = search)

##### Create the wd for landsat images downloads #####

wdLandsat <- file.path(scriptWD, 'landsat8')

wdLandsatDownload <- file.path(wdLandsat, 'downloads')

##### Baixando imagens #####

testDownload <- lsDownload(searchres = search,

                    AppRoot = wdLandsatDownload,

                    lvl = 1,

                    product = 'LANDSAT_8_C1',

                    extract.tif = TRUE,

                    username = '*****',

                    password = '*****',

                    nattempts = 5)
@caio-valente14
Copy link
Author

I tried to run a simple debug with lsDownload() and it seems that when the function calls a nested function named lsEarthExplorerDownload(), but since I'm a beginner in R, I couldn't find more details. This package has some great functions, and I aim to use them in my project. I hope you can fix the problem. Thanks a lot!

@michielvandijk
Copy link

I have exactly the same problem when trying to download Landsat 7 output. I agree with the others, this is an excellent package as it offers the possibility to easily download and process satellite data, which is not offered by any other R packages currently available. I would be very grateful if the authors can fix this issue in the very near future.

@caio-valente14
Copy link
Author

Another way of dealing with satelite images in R. There is a package called rgee, which connects an R session to Google Earth Engine API.

@unai-perez
Copy link
Member

Sorry for the errors with this package. The last few months the API that RGISTools uses to download images has changed a lot. Because of that, the package is not able to download the landsat images.The last months we have been working on a redefinition of the package. The new package is called rsat and can download landsat imagery. The package is not on CRAN but you can download it from GitHub.You can start using the package by reading the 4 vignettes it includes. Use this command to install the package from github:

devtools::install_github("spatialstatisticsupna/rsat", build_vignettes=TRUE)
browseVignettes("rsat")

@bholtdwyer
Copy link

Sorry, but shouldn't the page say somewhere that this has been superseded by rsat, if that's the case? Also, rsat's GitHub page appears to not have any "issues' tab, which is not helpful as it has multiple...issues! The vignettes don't build properly, and on loading it tries to load a package called "dplur" (looks like a typo to me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants