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

Tree canopy data link issue with get_nlcd #101

Closed
YoJimboDurant opened this issue Jun 5, 2023 · 2 comments
Closed

Tree canopy data link issue with get_nlcd #101

YoJimboDurant opened this issue Jun 5, 2023 · 2 comments

Comments

@YoJimboDurant
Copy link

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!

@bocinsky
Copy link
Collaborator

bocinsky commented Jun 6, 2023

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.

@YoJimboDurant
Copy link
Author

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.

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

2 participants