mapdeck icon indicating copy to clipboard operation
mapdeck copied to clipboard

add time slider without shiny

Open djouallah opened this issue 5 years ago • 5 comments

my dataset contain date column, ideally, I want to be able to generate an HTML file that contain a slider and the user can "move" the date.

Similar examples currently I am using Kepler.gl which do that, but I prefer to use R instead because of my workflow.

here is an example using Kepler.gl https://kepler.gl/demo/map?mapUrl=https://dl.dropboxusercontent.com/s/cq7d5wmf7kfq3bl/keplergl_hu7426c.json


TODO - development

  • [x] 'container' on the map to hold controls
  • [x] insert controls into container
  • [x] respond to user interacting with controls
  • [x] use updateTriggers to update the map

TODO - prototype

  • [x] range slider control
  • [x] scatterplot radius responds to control
  • [x] updateTrigger calls a function (e.g., the slider value is an input to a function which recalculates the radius, based on the data)
  • [ ] shiny slider control

TODO - production

  • [ ] user-customisable container css
  • [ ] user-customisable input css
  • [ ] control labels & text
  • [ ] insert & remove controls

djouallah avatar Aug 27 '19 23:08 djouallah

Yes this would be a very good feature, and one I've also thought about but haven't had any time to get it going. I envisage it would work similar to the Deckgl examples, where the sliders control part of the data

My idea is to have a function, something like add_control(), in which you can specify the type of control (slider, checkbox, radio button etc) and what it does. Then all controls get placed inside the main control container.

SymbolixAU avatar Aug 27 '19 23:08 SymbolixAU

@djouallah Do you have any time to try and get a minimal working prototype?

SymbolixAU avatar Aug 27 '19 23:08 SymbolixAU

key= "xxxx"
library(mapdeck)
library(sf)
url <- 'https://raw.githubusercontent.com/djouallah/interactivie_map/master/data.csv'
dataset <- read.csv(url)
map <- st_as_sf(dataset, coords = c( "pile_lng","pile_lat"), crs = 4326)


mapdeck(token = key, pitch = 45, style = 'mapbox://styles/mapbox/satellite-streets-v9',
                                         location = c(35.5, 5.2),zoom = 1) %>%
  add_sf(
    data = map
    , fill_colour = "status"
    , layer_id = "scatter_layer"
  )

djouallah avatar Aug 28 '19 02:08 djouallah

Would also be happy to help on that as I'll need such a feature too. But no idea how to implement this. https://docs.mapbox.com/mapbox-gl-js/example/timeline-animation/

pokyah avatar Sep 09 '19 11:09 pokyah

It's a slightly different approach to a pure Mapbox implementation because I need / should use Deck.gl's updateTriggers

I'm jotting most of my design ideas and prototypes in issue #1

SymbolixAU avatar Sep 09 '19 21:09 SymbolixAU