Search code examples
rmapdeck

elevation argument not working when fill_color is supplied in add_column in mapdeck


Using mapdeck to plot elevated columns. Elevation happens when fill_colour is ommitted. However when it is supplied, elevation is ignored. In document or code, there is no such indication that both cannot be used together.

library( mapdeck )
set_token( 'pk.eyJ1IjoicmFqaWJkZSIsImEiOiJjazlnMnhmdGwwMDRrM29ta2Rkbzh5cGVzIn0.SwdQj29syEZzMuTppFwY4A' )


df <- capitals
df$elev <- sample(50000:500000, size = nrow(df), replace = T)

mapdeck(style = mapdeck_style("dark"), pitch = 45) %>%
  add_column(
    data = df
    , lat = "lat"
    , lon = "lon"
    , elevation = "elev"
    , fill_colour = "lon"
    , disk_resolution = 20
    , radius = 100000
    , tooltip = "capital"
  )

Solution

  • This now works as it should in v0.3.3 on CRAN 20200515

    df <- capitals
    df$elev <- sample(50000:500000, size = nrow(df), replace = T)
    
    mapdeck(style = mapdeck_style("dark"), pitch = 45) %>%
      add_column(
        data = df
        , lat = "lat"
        , lon = "lon"
        , elevation = "elev"
        , fill_colour = "lon"
        , disk_resolution = 20
        , radius = 100000
        , tooltip = "capital"
      )
    
    

    enter image description here