Empty reply from server when downloading NLCD 2016 in R

Viewed 93

I am trying to download the NLCD 2016 Land Cover Dataset in RStudio. The area I am trying to get data for is roughly that of New York State. The code I am using at this point is:

library(FedData)
library(sf)

NYSbb <- data.frame(lat = c(40,45.2),
                 lon = c(-71,-80))
NYSbb_df <- st_as_sf(NYSbb, 
                    coords = c("lon","lat"), 
                    crs = 4326)
NLCD <- get_nlcd(template = NYSbb_df,
         label = "NYS",
         dataset = "Land_Cover",
         year = 2016,
         force.redo = T) # Left this line in here because of cancelled download attempts

The error I receive after running this code is the following:

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Empty reply from server

I understand that a curl error is some sort of a server error. I am on a personal computer, and I have no problem accessing the NLCD website from my internet browser.

1 Answers

This is most likely due to making a plain HTTP request to a server that does HTTPS.

Try changing your url to https://...

Related