0

I have an sf linestring object, with a value attached to them. The lines are intended to remain static, but I their colours to be graduated according to the value and evolve over time in a specific day.

I have managed to get the timeslider working however it only shows me the evolution of the lines themselves till the first point in time, and not even all of them. The dataset is as follows.

Location A Location B Travel time Values Query Hour Time Geometry
Place ID character Character Numeric Lubridate Period object 'query hour turned into POSIXct Linestring
A B 123 30m 0s 1970-01-01 00:30:00
A B 123 01H 30m 0s 1970-01-01 01:30:00 (and so on till 23:30)
A C 123 30m 0s 1970-01-01 00:30:00
A C 123 30m 0s 1970-01-01 01:30:00 (and so on till 23:30)
B A 123 30m 0s 1970-01-01 00:30:00

I am using the following code to create the map

time_map <- leaflet() %>% addProviderTiles(providers$CartoDB.Positron) %>%
                addTimeslider(data = test_st, timesliderOptions(range = TRUE))

time_map

with the following results as seen in the image. https://i.stack.imgur.com/wiPem.jpg The timeslider won't move past 00:30:00 I do have quite a lot more location pairs than displayed.

I tried setting the range to true

time_map <- leaflet() %>% addProviderTiles(providers$CartoDB.Positron) %>%
                addTimeslider(data = test_st, timesliderOptions(range=TRUE))

time_map

with an error

Error in rcpp_sf_to_geojson(sf, digits, factors_as_string) :
Unknown R object type

I would appreciate any help I have been stuck on this for a long time. I don't fully understand the object types required in making a leaflet time map, and I cannot make sense of the error at all.

The default timeAttribute column is "time" and that's what it is in my data so I haven't added that parameter.

For context, I haven't added the colour palette and visualisation options yet. And the end product would be making such a map with 7 layers, one for each day of the week.

Thanks

I tried working out every combination in the documentation, and also plotly, however plotly is worse.

suyash_n
  • 3
  • 2

0 Answers0