Tree canopy data link issue with get_nlcd
Closed this issue · 2 comments
Hi -
When I run the following I get an error that the service is not available on the mrlc server:
library(FedData)
library(tidyverse)
library(sf)
station_mesowest <- tibble(surf_Latitude = 42.27056,
surf_Longitude = -71.87306,
surf_Elevation = 1007 * 0.3048)
sfc_station_point <-
data.frame(long = station_mesowest$surf_Longitude, lat = station_mesowest$surf_Latitude) %>%
st_as_sf(coords = c("long", "lat"), crs = 4326)
sfc_station <- sfc_station_point %>%
st_buffer(dist = 5500)
tc_2016 <-
get_nlcd(
as(sfc_station, "Spatial"),
dataset = "canopy",
label = "canopy",
extraction.dir = paste(rootDir, "preprocessed_data", sep = "/"),
force.redo = T,
year = 2016,
raster.options =c("COMPRESS=NONE", "TFW=YES", "datatype=INT1U")
)
The error is specifically:
Error in get_nlcd(as(sfc_station, "Spatial"), dataset = "canopy", label = "canopy", :
No web coverage service at https://www.mrlc.gov/geoserver/mrlc_download/NLCD_2016_Tree_Canopy_L48/wcs. See available services at https://www.mrlc.gov/geoserver/ows?service=WCS&version=2.0.1&request=GetCapabilities
I dig into the mrlc and it appears that the new link is now:
"https://www.mrlc.gov/geoserver/mrlc_download/nlcd_tcc_conus_2016_v2021-4/wcs?"
When I run get_nlcd
in debug mode and switch the coverage in line 82 to:
coverage <- "nlcd_tcc_conus_2016_v2021-4"
the function appears to work without complaint.
Other 2016 nlcd datasets do not appear to be impacted (e.g. landuse and impervious) at this time.
As noted in the source code the mrlc is oft-changing.
Thanks for developing and keeping up with this - FedData is such a great package!
Constantly changing! And, yep, naming convention wasn't adhered to when they updated those canopy layers. Pushing a fix now, and will include in my next CRAN release.
Thanks for the quick turn around! I wish they had an index - I thought maybe there would be a way to scrape the links from https://www.mrlc.gov/data and create the links on the fly, but I could not seem to get at the hyperlinks in the url.