Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with enableMeasurePath() #233

Closed
smailmy opened this issue Nov 24, 2024 · 2 comments
Closed

issue with enableMeasurePath() #233

smailmy opened this issue Nov 24, 2024 · 2 comments

Comments

@smailmy
Copy link

smailmy commented Nov 24, 2024

I'm using the enableMeasurePath() and addMeasurePathToolbar() to display areas and perimeters, the thing is that is displaying this information for all circles created by addCircles() as well which is slowing the whole app, i don't want that, i want to display area only for shapes that created manually, is there a workaround for this?

@trafficonese
Copy link
Owner

I just pushed 86285f1 which allows a group argument for addMeasurePathToolbar. Can be a single group, multiple groups or NULL (default), which will work for all layers.

Would that fix your issue?

Here is an example, where the measurements are only allowed for "Group 1".

library(leaflet)
library(leaflet.extras)

n = 50
leaflet() %>%
  addTiles() %>%
  # Add 3 groups of circles
  addCircles(runif(n, -10, 30), runif(n, 35, 70), radius = runif(n, 10000, 50000), 
             group = "Group 1", color = "red") %>%
  addCircles(runif(n, -10, 30), runif(n, 35, 70), radius = runif(n, 10000, 50000), 
             group = "Group 2", color = "green") %>%
  addCircles(runif(n, -10, 30), runif(n, 35, 70), radius = runif(n, 10000, 50000), 
             group = "Group 3", color = "blue") %>%
  # Enable measurements for Group 1 only
  addMeasurePathToolbar(group = "Group 1") %>%
  addLayersControl(overlayGroups = c("Group 1", "Group 2", "Group 3"))

@trafficonese
Copy link
Owner

@smailmy I'll close this for now.
Feel free to re-open the issue if that doesn't solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants