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
leafletjs @react-leaflet/core/esm/path.js
Hi im trying to use leaflet in a project. But when i executed the result is:
./node_modules/@react-leaflet/core/esm/path.js 10:41
Module parse failed: Unexpected token (10:41)
File was processed with these loaders:
*…

Daniel ORTIZ
- 2,488
- 3
- 21
- 41
3
votes
1 answer
How to add Leaflet.Locate to an R made map (instead of locate)
I was looking into this repo, where a blue dot is added to your leaflet map, that if you open it on a phone, it follows you as you walk, similar to a google maps option, as shown in this demo.
Usually in R and using Rmd, I would have this code so…

Derek Corcoran
- 3,930
- 2
- 25
- 54
3
votes
1 answer
How to render HTML styled leaflet label?
I need to add labels (not poups) to each existing marker on the map. I created labelText variable which stores HTML for a label. And now, when I'm using it with then strange thing happen - each label shows data from the whole dataset, not data…

mustafa00
- 751
- 1
- 7
- 28
3
votes
1 answer
How to filter years in shiny leaflet in sliderbar (Interactive map)
library(shiny)
library(leaflet)
library(RMySQL)
library(DBI)
data <- function(con){
con <- dbConnect(MySQL(), dbname="", host="localhost",
port = , user="",
password="")
dbSendQuery(con, "SEt NAMES…

이훈석
- 45
- 5
3
votes
2 answers
How can I wrap long text strings in tmap HTML polygon popups or fixed widths? Can tmap recognize line breaks?
I am using the tmap package (v. 3.0 and I also tried v. 3.2) in R to make an HTML map. I have a spatial polygon of both numeric and character text fields. In a few of my text fields, I have a list of items, which are semi-colon (;) separated. For…

Tia
- 31
- 2
3
votes
1 answer
R Leaflet: Add a Range Slider to Filter Markers without Shiny
I have a dataset like the one below. Is there a way without shiny (e.g. any javascript code or leaflet plugins) to add a range slider to filter the points based on the values in a column (e.g. a Date variable)? Something like in the code below with…

Ray Larone
- 308
- 4
- 18
3
votes
1 answer
R Leaflet: Assign multiple groups to a layer to filter data and change column represented
I am trying to find a way in R leaflet to include overlay buttons which filters out groups in the data. I also need to include radio buttons which switch the column which is being represented in the data. I can't seem to find a way to do this in R…

Ray Larone
- 308
- 4
- 18
3
votes
1 answer
How to insert saved Leaflet widget into Rmarkdown HTML output
I create a Leaflet widget and save it locally:
library(htmlwidgets)
library(leaflet)
library(sf)
shp = st_read("/path/to/some/shapefile.shp")
m = shp %>%
leaflet() %>%
addProviderTiles(providers$CartoDB.Positron) %>%
setView(lng = -70, lat =…

ardaar
- 1,164
- 9
- 19
3
votes
0 answers
Geocode Data - How to Use .kml File in R
I've used some open source data to produce choropleth maps showing population density in the Republic of Ireland using the leaflet package in R.
Found a suitable .kml file which is based on the same geocodes as my table of population density (it's…

Alan
- 619
- 6
- 19
3
votes
1 answer
Update leaflet provider tile options without adding and removing
I'm using leaflet in a shiny app to display my data along with several base layers. One of the layers is the very nice daily MODIS satellite imagery provided by NASA GIBS.
The issue is that I cannot figure out how to update the date of the NASA…

Sean Raffuse
- 186
- 8
3
votes
1 answer
In Leaflet for R, can column variables be used to vary size of labelOption size, colour, etc.?
I am trying to create a high-quality map of a small part of the UK, without any distortions caused by the use of projections, and with the addition of markers consisting of text and symbols. Ultimately the goal is to write out a png or pdf file. An…

SlowLearner
- 7,907
- 11
- 49
- 80
3
votes
1 answer
how to show multiple texts on pop-up in leaflet map in r
I made an interactive map using leaflet package in r. I created an example dataset as below. There are two cities, London and Birmingham. 3 tweets from London and 2 from Birmingham. What I want to do is click on marker on map to show all the tweets…

zesla
- 11,155
- 16
- 82
- 147
3
votes
1 answer
Polygons only display when data is called within leaflet()
I am trying to map multiple layers of Polygons to a leaflet map. The polygons show up when added separately, but not together, throwing an error: "Error in derivePolygons(data, lng, lat, missing(lng), missing(lat), "addPolylines") :
addPolylines…

Julia
- 31
- 3
3
votes
1 answer
Square markers in Leaflet for R
In JS Leaflet, you can create a divIcon that is square and in the colour of your choice, for example this square purple marker:
How can this be achieved in Leaflet for R? Bonus question: how can the colour depend on a property value from geojson…

fifthace
- 506
- 1
- 10
- 33
3
votes
1 answer
add state borders to the output of leaflet where the input is counties shapefile
I downloaded the county shapefile off of data.gov. I can use them in leaflet as follows to plot counties in WA, ID and OR. I would like to make the state borders thicker. How can I do that?
counties <- readOGR(paste0(dir,…

OverFlow Police
- 861
- 6
- 23