pfrater / arcpullr

21 stars 9 forks source link

Cannot reproduce get_map_layer() example with WI landcover data #1

Open spcanelon opened 1 year ago

spcanelon commented 1 year ago

Hi there, I'm so excited to have found this package! I'm sure it will save me from future headaches 😄

I ran into issues pulling data for my own example with PASDA landcover data, so I instead tried reproducing the example included in the documentation. But I ran into trouble there too. Here are the steps I followed:

# WDNR Server
image_server <- "https://dnrmaps.wi.gov/arcgis_image/rest/services/"

# WI Landcover Type URL
landcover_path <- "DW_Land_Cover/EN_Land_Cover2_Lev2/MapServer"
landcover_url <- paste0(image_server, landcover_path)
# defining the WI shape
wis_poly <- arcpullr::wis_poly
# pulling map data
wi_landcover <- get_map_layer(landcover_url, wis_poly)

And then I got the following error:

Warning: [rast] unknown extent
Warning: [rast] unknown extent

Any idea what might be going on here? Let me know if I can provide any addiitonal context.

pfrater commented 1 year ago

Hi Silvia, I’m super happy to hear your interest in the package! Sorry about the warning. I’m not sure exactly what is going on, but have a feeling it has to do with a discrepancy between the projection and setting the raster extent. I just had surgery, so not leaving the couch for the next few days (writing this from my phone), but I’ll dig into this once I’m back up and running. A couple of questions for you: what OS are you on and what version of R. Also, does the layer actually pull into R (I.e. can you plot and work with the object), or is it just a NULL object?

spcanelon commented 1 year ago

Hi Paul! Thanks for your message, and please take your time in looking into the issue. Wishing you a smooth and thorough recovery!

To answer your questions:

As for the layer: I'm glad you asked because I can see that it does get pulled in! That alone is already helpful to me (I'm brand new to working with raster data). There is a large raster layer object wi_landcover in my environment with 160k elements and I can run the following successfully:

library(raster)
plot(wi_landcover)

Landcover raster image of the state of Wisconsin, USA

However, if I try to plot the data with arcpullr::plot_layer(wi_landcover), I get the following error:

Error in data.frame(color = raster_cols, name = raster_names) : 
arguments imply differing number of rows: 0, 17