qfes / rdeck

Deck.gl widget for R
https://qfes.github.io/rdeck
MIT License
97 stars 0 forks source link

`update_mvt_layer` fails when missing point_type argument #87

Closed bdbmax closed 1 year ago

bdbmax commented 1 year ago

When updating an MVT layer, it fails with:

Error in `update_mvt_layer()`:
! Failed to create layer
Caused by error in `if (!grepl("icon", layer$point_type, fixed = TRUE)) ...`:
! argument is of length zero

When not supplied a point_type argument.

This works:

test_map <- 
  rdeck(initial_view_state = view_state(center =  c(-73.58, 45.53), zoom = 15)) |> 
  add_mvt_layer(id = "test",
                data = tile_json("mapbox.mapbox-streets-v8", "mapbox"))

update_mvt_layer(test_map,
                 id = "test",
                 line_width_min_pixels = 1,
                 point_type = "circle")

This doesn't:

test_map <- 
  rdeck(initial_view_state = view_state(center =  c(-73.58, 45.53), zoom = 15)) |> 
  add_mvt_layer(id = "test",
                data = tile_json("mapbox.mapbox-streets-v8", "mapbox"))

update_mvt_layer(test_map,
                 id = "test",
                 line_width_min_pixels = 1)
anthonynorth commented 1 year ago

Fixed in dev/latest