A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/SymbolixAU/mapdeck/issues/190 below:

Legends don't appear with add_geojson · Issue #190 · SymbolixAU/mapdeck · GitHub

I'm trying to add a legend with the Geojson layer but I won't work. It does work in add_polygon, but I need to be working with Geojson for a project.

Example below;

library(mapdeck)
sf <- geojsonsf::geojson_sf( geojson )
sf$width <- sample(1:100, size = nrow(sf), replace = TRUE)
sf$elevation <- sample(100:1000, size = nrow(sf), replace = T)
geo <- geojsonsf::sf_geojson( sf )


             
l1 <- legend_element(variables = 1:4, 
                        colours = c("#92637C", "#3A7FB9", "#5872A3", "#B5C9E3"),
                        colour_type = "fill",
                        variable_type = "category")

js <- mapdeck_legend(l1)

#Legend works
mapdeck(
  location = c(145, -37.9)
 , zoom = 8
 , style = mapdeck_style("dark")
 , pitch = 35
) %>% 
   add_polygon(data = sf,
               fill_colour = "fillColor",
               legend = js)

#No legend
mapdeck(
  location = c(145, -37.9)
 , zoom = 8
 , style = mapdeck_style("dark")
 , pitch = 35
) %>%
 add_geojson(
   data = geo,
   layer_id = "diabetes",
   legend = js
 )

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4