mapview icon indicating copy to clipboard operation
mapview copied to clipboard

Error when include code in x argument for mapview

Open see24 opened this issue 2 years ago • 3 comments

Seems like it is using a quoted version of the object name in a file path but that doesn't work when there is code in the argument

mapview::mapview(raster::raster(matrix(1:100)))

Error in normalizePath(path.expand(path), winslash, mustWork) : path[1]="lib/raster::raster(matrix(1:100))_0c1be5-1": The filename, directory name, or volume label syntax is incorrect In addition: There were 45 warnings (use warnings() to see them)

see24 avatar May 24 '23 15:05 see24

Yeah, that error message stems from the leaflet package if I am not mistaken. Did you try with leaflet?

tim-salabim avatar May 24 '23 15:05 tim-salabim

This worked in leaflet, in that it didn't have an error:

leaflet::leaflet()|> leaflet::addRasterImage(raster::raster(matrix(1:100), crs = "EPSG:3857"))

Could be that the error comes from leaflet but I am not familiar enough to trigger it there. You could catch it in mapview and give a more informative error message. Or maybe you can create an issue in leaflet if you know how to trigger it?

see24 avatar May 24 '23 17:05 see24

I'll try to look into it, but I don't have much time at the moment. A work around for the time being is to assign to a variable and use that in mapview

tim-salabim avatar May 24 '23 18:05 tim-salabim