You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to download Landsat bands for Indonesia, but I keep getting an obscure (not helpful) error message. An example below. Note that in the real example I'm of course using my own EarthExplorer/USGS username and password, as character strings. I'm currently logged into EarthExplorer with those credentials.
#Import a basic map of the world to try to pull down data associated with Indonesia.
require(maptools)
require(sf)
#Pull in a shapefile of simplified country outlines
data(wrld_simpl)
class(wrld_simpl)
#Make this a "sf" class object
wrld_simpl=st_as_sf(wrld_simpl)
class(wrld_simpl)
#Shapefile of just Indonesia.
require(dplyr)
indonesia = wrld_simpl %>% filter(NAME=="Indonesia")
#Plot the shapefile. It's a real place.
require(ggplot)
ggplot(indonesia) + geom_sf()
#############################
#Attempt to search for Landsat 8 data over Indonesia, specifying the area of interest 2 different ways:
#From the documentation of "lsSearch"
# region: a ‘Spatial*’, projected ‘raster*’, o r ‘sf’ class object
# defining the area of interest. This argument is mandatory if
# ‘pathrow’, ‘extent’, or ‘lonlat’ are not defined.
class(indonesia)
#Literally the example given in the help file, just using my username and password and the Indonesia shapefile.
sres <- lsSearch(product = "LANDSAT_8_C1",
startDate = as.Date("01-01-2011", "%d-%m-%Y"),
endDate = as.Date("31-12-2013", "%d-%m-%Y"),
username = earthexplorer_username,
password = earthexplorer_password,
region = indonesia)
#Returns a cryptic error:
#Error in if (res$error != "") { : argument is of length zero
#From the documentation of "lsSearch"
# extent: an ‘extent’, ‘Raster*’, or ‘Spatial*’ object
# representing the region of interest with
# longitude/latitude (EPSG:4326) coordinates. This argument
# is mandatory if ‘region’, ‘pathrow’ or ‘lonlat’ are not
# defined.
require(raster)
class(extent(wrld_simpl))
#Literally the example given in the help file, just using my username and password and the Indonesia shapefile.
sres <- lsSearch(product = "LANDSAT_8_C1",
startDate = as.Date("01-01-2011", "%d-%m-%Y"),
endDate = as.Date("31-12-2013", "%d-%m-%Y"),
username = earthexplorer_username,
password = earthexplorer_password,
extent = extent(wrld_simpl))
#Exact same cryptic error.
I'm not sure what the problem is, but whatever it is, returning an error that tells me something other than res$error != "" would be really helpful. Given the naming, I suspect there was an error downloading the files? If so, returning an error message like "Unable to download files, please check credentials" or "EarthData server not responding" would be really helpful!
The text was updated successfully, but these errors were encountered:
I'm trying to download Landsat bands for Indonesia, but I keep getting an obscure (not helpful) error message. An example below. Note that in the real example I'm of course using my own EarthExplorer/USGS username and password, as character strings. I'm currently logged into EarthExplorer with those credentials.
I'm not sure what the problem is, but whatever it is, returning an error that tells me something other than res$error != "" would be really helpful. Given the naming, I suspect there was an error downloading the files? If so, returning an error message like "Unable to download files, please check credentials" or "EarthData server not responding" would be really helpful!
The text was updated successfully, but these errors were encountered: