mapview icon indicating copy to clipboard operation
mapview copied to clipboard

Error message when using mapview with filtered data

Open jguelat opened this issue 7 months ago • 5 comments

This is one is really strange... It's working in a previous version of R (4.3.3) using the same mapview (2.11.2) and leaflet (2.2.2) versions but it's failing now with R 4.5. I guess it's maybe linked to other package dependencies...

library(mapview)
mapview(franconia[franconia$NUTS_ID == "DE241",])

Error: cannot open the connection In addition: Warning messages: 1: In file.create(to[okay]) : cannot create file 'C:\Users\jgu\AppData\Local\Temp\Rtmp4QKa0h\file18546cf34249/franconia[franconia$NUTS_ID == "DE241", ]_layer.fgb', reason 'Invalid argument' 2: In file(con, "w") : cannot open file 'C:\Users\jgu\AppData\Local\Temp\Rtmp4QKa0h\file18543c959b6/franconia[franconia$NUTS_ID == "DE241", ]_home-button.css': Invalid argument

It's working if I specify the layer name:

mapview(franconia[franconia$NUTS_ID == "DE241",], layer.name = "DE241")

jguelat avatar May 08 '25 06:05 jguelat

Thanks, seems to be an issue with naming of the internally created .fgb file. It works with

library(mapview)

mapviewOptions(fgb = FALSE)
mapview(franconia[franconia$NUTS_ID == "DE241",])

I'll look into this.

tim-salabim avatar May 08 '25 06:05 tim-salabim

Thanks! Unfortunately I'm also getting an error after setting the option fgb = FALSE

Error: cannot open the connection In addition: Warning message: In file(con, "w") : cannot open file 'C:\Users\jgu\AppData\Local\Temp\Rtmpkh5pvW\file3578791053a4/franconia[franconia$NUTS_ID == "DE241", ]_home-button.css': Invalid argument

jguelat avatar May 08 '25 09:05 jguelat

Ok, that seems windows specific then.

tim-salabim avatar May 08 '25 10:05 tim-salabim

I've just tested it on a mac... If fgb = TRUE, there is no error message but no feature is displayed on the map. If fgb = FALSE, then everything works fine.

jguelat avatar May 09 '25 12:05 jguelat

Thanks! That is the same behaviour as on linux

tim-salabim avatar May 09 '25 13:05 tim-salabim

This should work now with the latest versions of mapview and leafem (pushed to CRAN yesterday). Feel free to re-open if not fixed.

tim-salabim avatar Aug 29 '25 07:08 tim-salabim

Thanks, it's working perfectly!

jguelat avatar Sep 01 '25 09:09 jguelat