pfrater / arcpullr

21 stars 9 forks source link

get_image_layer error #8

Closed bchileen closed 1 year ago

bchileen commented 1 year ago

Im having trouble this week getting a RasterBrick from the get_image_layer function. Last week this function was working but it is currently throwing an error. Heres a reproducible example using package data and the national map elevation image server.

`wis_counties<-arcpullr::wis_counties adams<-wis_counties[wis_counties$county=="adams",] adams_bbox<-sf::st_bbox(adams) url<-"https://elevation.nationalmap.gov/arcgis/rest/services/3DEPElevation/ImageServer/"

adams_elevation<-get_image_layer(url,adams) adams_bbox_elevation<-get_image_layer(url,bbox=adams_bbox, bbox_crs="4326")`

pfrater commented 1 year ago

@bchileen I've been having issues with this too lately. Do you get the following error? This is what I get:

Error in .local(.Object, ...) : An error occurred while creating a virtual connection to the DAP server:Error while reading the URL: https://elevation.nationalmap.gov/arcgis/rest/directories/arcgisoutput/3DEPElevation_ImageServer/_ags_ac1400f3_8e8c_4c97_b3ee_692103811e57.png.ver. The OPeNDAP server returned the following message: Bad Request:

Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) : Cannot create a RasterLayer object from this file. (file does not exist)

bchileen commented 1 year ago

When I run it, this is the error I get: adams_elevation<-get_image_layer(url,adams) Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) : Cannot create a RasterLayer object from this file. (file does not exist) In addition: Warning message: HTTP error code : 400 (GDAL error 1)

If I run the functions enough times, I rarely/unreliably can get the rasterbrick returned with the following errors: adams_elevation<-get_image_layer(url,adams) Warning messages: 1: [rast] unknown extent 2: HTTP error code : 400 (GDAL error 1) 3: [rast] unknown extent

but this has happened about once over the past few days of testing/running it. I was able to produce a rasterbrick last Wednesday/Thursday if that helps for reference.

pfrater commented 1 year ago

@bchileen I think the error you were experiencing should be fixed under commit 94698c4. I altered how the layer was being pulled and it seems to work for me.