Hello, I was trying to use add_circle_layer() to add a few points on a map and noticed that it would error if the data contained at least two rows and only columns for latitude and longitude.
Works (lat/lon + one column):
library(mapgl)
map_dat <- data.frame(lat = c(45, 50), lon = c(-45, 50), foo = 1:2) |>
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326)
maplibre(projection = "mercator") |>
add_circle_layer(id = "poi-layer", source = map_dat)
Fails (lat/lon only):
library(mapgl)
map_dat <- data.frame(lat = c(45, 50), lon = c(-45, 50)) |>
sf::st_as_sf(coords = c("lon", "lat"), crs = 4326)
maplibre(projection = "mercator") |>
add_circle_layer(id = "poi-layer", source = map_dat)
# Error in `vapply()`:
# ! values must be length 1,
# but FUN(X[[2]]) result is length 2
I don't use any other feature of the data in add_circle_layer() so this error looks like a bug to me.
mapgl 0.5.0
Hello, I was trying to use
add_circle_layer()to add a few points on a map and noticed that it would error if the data contained at least two rows and only columns for latitude and longitude.Works (lat/lon + one column):
Fails (lat/lon only):
I don't use any other feature of the data in
add_circle_layer()so this error looks like a bug to me.mapgl0.5.0