lines not showing in mapview when they show in tmap
I have a very odd problem that I cannot get a grip on. tmap correctly displays some linestrings, while mapview does not. I am sharing the dataframe here as object t https://www.dropbox.com/scl/fi/ye672mfbcaja7mx1dioeo/shape.Rds?rlkey=ykf3ftutyxgn17s98bjauhsk1&dl=0
tm_shape(t) + tm_lines()
mapview:
mapview::mapview(t)
What is really weird is that I can plot the lines if I filter them explicity. See how the blue line well below Bordeaux now is plotted.
t %>% filter(id == "40014") %>% mapview::mapview()
thanks for any help with this!
Hi, there's an empty linestring in your data. Apparently, tmap will exclude those while mapview does not, meaning that it will not plot data after the empty linestring:
library(sf)
library(mapview)
t = readRDS("/home/tim/Downloads/shape.Rds")
st_is_empty(t) |>
sum()
which(st_is_empty(t))
mapview(t[-which(st_is_empty(t)), ])
we should probably have a proper warning about this somewhere...
argh! should have thought of that. thanks so much!
No worries, I'll leave this open as a reminder to implement some warning at some stage