This R package makes it easy to integrate and control the open-source JavaScript Leaflet software in R.
Questions tagged [r-leaflet]
499 questions
3
votes
0 answers
Panning leaflet map or Plotly plot in draggable Shiny panel also moves panel
When using a leaflet map inside a draggable Shiny panel (e.g. absolutePanel with draggable=T), panning the leaflet map with the mouse also drags the Shiny panel.
Is there a way to prevent panning the map with the mouse from also moving the Shiny…

jakevl
- 96
- 1
- 5
3
votes
1 answer
Color in legend doesn't match the color in map
Basically, I tried to use colors to show the value, however, when I add a legend, the color in legend doesn't match the color in the map.
output$map <- renderLeaflet({
temp<-data[data$coralType==input$type,]
temp<-…

Eric
- 56
- 3
3
votes
1 answer
R Leaflet Map Polygon Labels on highlight have incorrect label
I am creating a map in R using leaflet and the labels for my polygons are not lining up with what their value should be.
The map is meant to separate just Ontario by FSA (Forward Sortation Area), the geojson includes all the FSAs in Canada.
So…

Glenne Grossman
- 71
- 7
3
votes
1 answer
How do I click on a leaflet map, create a marker, and then delete that marker when I click elsewhere in R
I have created a shiny application the displays a leaflet map of points in a data frame.
I want to allow the user to click anywhere on the map to get some information on nearby points and leave a marker on that point.
It is possible that they…

Pete
- 321
- 4
- 16
3
votes
1 answer
How to set preferCanvas flag to True in Leaflet for R
I am using Leaflet R package for rendering Leaflet map. I want to render my map with Canvas instead of SVG. For this to achieve I need to set preferCanvas flag to true in Leaflet Options. But I am not able to do so in Leaflet for R (map still…

Saurabh Palatkar
- 3,242
- 9
- 48
- 107
3
votes
2 answers
colorBin() leaflet in R not working as expected
I have a data.frame with two (2) rows in it. I am trying to map this data with colors using the colorBin function from leaflet
my_data <- data.frame("11772","8600000US11772","11772","41957005","1150010","Patchogue","Suffolk","195")
my_data2 <-…

MCP_infiltrator
- 3,961
- 10
- 45
- 82
3
votes
0 answers
Return a rendered leaflet map from leafletProxy()
Is it possible to retrieve a leaflet map in Shiny after it's already been rendered?
Here is an example in code that shows how a map generated by leaflet() is different from one that is returned from leafletProxy() even though they would appear the…

Steven M. Mortimer
- 1,618
- 14
- 36
3
votes
1 answer
Choices in selectInput to appear over a Leaflet Map
I am building a shiny application where a user is able to see ships of various types by selecting a vessel type from a selectInput(). Based on the selection, vessels get filtered and are displayed on a leaflet map. However, the choices in the…

Dhiraj
- 1,650
- 1
- 18
- 44
3
votes
1 answer
r leaflet shiny app in shiny.io error
I'm trying to run my shiny app on shinyapp.io.
https://mrmoleje.shinyapps.io/north-america-massacres/
The app runs fine in R Studio, however in the server the 'popups' in my leaflet map completely disappear. There isn't anything in the shiny.io log…

Mrmoleje
- 453
- 1
- 12
- 35
3
votes
2 answers
Combining conditional evaluation within dplyr pipe operators (%>%)
So I found a quite similar question, here on SO, but I am unable to get it fixed for my problem. I am building a map in Shiny leaflet. What I want, is when a certain variable has certain values (conditions), make a addAwesomeMarkers(); else, make a…

JohnDoedel
- 131
- 1
- 10
3
votes
0 answers
Leaflet html widget (sparkline) in popup
Popups and labels reportedly can have arbitrary html as their content. I would like to add eg a sparkline to a popup or label in leaflet using R, hopefully without needing to learn javascript.
I have tried pasting the html content of the output of…

akorejwa
- 137
- 7
3
votes
1 answer
Select only one state in a map in a Shiny application
I have the following dataset:
library(rgdal)
library(leaflet)
tmp <- tempdir()
url <- "http://personal.tcu.edu/kylewalker/data/mexico.zip"
file <- basename(url)
download.file(url, file)
unzip(file, exdir = tmp)
mexico <- readOGR(dsn = tmp, layer =…

Henk Straten
- 1,365
- 18
- 39
3
votes
1 answer
labels in leaflet r with HTML tags
All good souls, help needed. I am creating a leaflet map and cannot resolve a strange issue with labels. I created labels with few variables and the labels render ok if the first variable is numeric, but they fail if the first is a string - any idea…

Slav
- 469
- 4
- 18
3
votes
0 answers
R Leaflet: draw curved line between points
I'm trying to draw curved lines between nearby locations in leaflet.
All the responses to similar questions on SO suggest using gcIntermediate() from the geosphere package, however that does not work for nearby locations as the curvature is so…

jzadra
- 4,012
- 2
- 26
- 46
3
votes
0 answers
R Leaflet cannot loop addPolylines
My objective is to draw lines in Leaflet with data from a csv file.
Example data:
point lat long SiteName group colour endlat endlong id
A 52.169868 4.66844 Kruisweg-Vriezekoop L1 green 52.22576 4.676024 1
For now, I have a…

Rhea
- 31
- 2