mapview icon indicating copy to clipboard operation
mapview copied to clipboard

datetime as default aesthetic

Open mdsumner opened this issue 2 years ago • 0 comments

there's an error from leaflet when datetime is the default column available - should this go to leaflet rather than here?

this had us going for a while, because we're dealing with pure long,lat,time data and datetime is not handled:

v <- sf::st_as_sf(data.frame(x = 0:10, y = seq(0, 20, length.out = 11), t = Sys.time() + 0:10), coords = c("x", "y"), crs = "OGC:CRS84")
mapview(v)     

Error in dispatch(map, "fitBounds", leaflet = { : Invalid map parameter

It's simple enough to as.integer that and get something useful (albeit not especially meaningful)

v$t <- as.integer(v$t)
mapview(v)     

I know that formatting this stuff would be a can of worms, but I think that's a better result than the weird error. We just wanted to see the points and how they change in time from some real tracking data.

image

mdsumner avatar Nov 02 '23 23:11 mdsumner