Questions tagged [r-leaflet]
This R package makes it easy to integrate and control the open-source JavaScript Leaflet software in R.
r-leaflet
703
questions
1
vote
1
answer
26
views
How to update fillColor to selected input in shiny and leaflet map
I am having a difficult time transitioning my map from static to reactive so a user can select what data they want to look at. I am pretty new to R so please bare with me but I think I figured out how ...
1
vote
1
answer
25
views
How to assign a leaflet layer to a group, when that layer is created by an extension of leaflet?
This R code creates a leaflet map with two base layers. The user can toggle between the two layers.
leaflet() |>
addTiles(group = "group 1") |>
addProviderTiles(provider = ...
1
vote
1
answer
23
views
How to add markers in a Leaflet minimap?
I have created an application in Shiny which allows for selecting a place and then displays a datatable with information and a marker at the corresponding position in the map. The marker is set in ...
-1
votes
0
answers
20
views
`colorNumeric()`: ! Wasn't able to determine range of domain
I am trying to read a shapefile and assign colors using leaflet colorNumeric() to variable V4 which are numeric but discontinuous. It has values 1 to 16 and then 74 to 95 with some missing values in ...
1
vote
1
answer
25
views
How can I use the AllMaps leaflet plugin with R?
Leaflet allows one to use custom map tile URLs. Here's an example from the docs.
library(leaflet)
leaflet() %>% addTiles() %>% setView(-93.65, 42.0285, zoom = 4) %>%
addWMSTiles(
"...
1
vote
1
answer
39
views
Table Display based on filter selection and custom polyline click
I have a shapefile with segments of varying lengths. For each segment, I have attributes including segment id, year, time period, and other variables like traffic volume. Right now a user is able to ...
2
votes
0
answers
31
views
How to dynamically update Leaflet markers with custom icons based on slider input?
I am working on a Shiny app where I want to display a Leaflet map with markers that have custom icons. The icons should change based on a year selected using a slider input. Specifically, markers ...
1
vote
1
answer
24
views
How to Separate Lines for Labels?
I have the following code in R Shiny for a data dashboard I'm working on, but I want the "Median Carbon Level" to be on a seperate line than the "Percent Increase from 2015" ...
0
votes
0
answers
14
views
R Markdown doesn't plot leaflet map in Word document
I'm working on a Word document with a leaflet maps. In RStudio the leaflet maps works good, but when I Knit my Word document with Rmarkdown, no map appears in Word. I recently change my computer and ...
0
votes
1
answer
65
views
Connecting R Leaflet to esri vector tile service
I'm building a Shiny leaflet application that I want to use a ESRI vector tile map from my organization for. I can see that leaflet connects to it as the attribution is accurate. However the tiles ...
0
votes
0
answers
55
views
Why are my leaflet points stuck to the map edge?
I try to plot transit stops on a leaflet map, indicating local clustering ("LISA"), based on Moran's I. The map is embedded in an R markdown file.
I've successfully done that with polygon ...
0
votes
1
answer
39
views
The position of map (leaflet) not updating from dropdown user input R
I have a global variable called map_status, selectedDropdownData.
mapStatus <<- list(map_lng = -110.9747, map_lat = 32.2226, map_zoom = 12)
selectedDropdownData <<- NULL
I currently ...
1
vote
1
answer
40
views
Click on a subregion and autoscale zoom to fit the subregion
I'm developing an R Shiny app and want to have an interactive map, where the user clicks on a region (or subregion), and the map automatically zooms and scales the view to fit the selected region. ...
0
votes
1
answer
52
views
Problem with deploying shiny app/leaflet to shinyapps.io
I am trying to deploy a very simple app to Shinyapps.io.
My app is the following, and the structure of the folder is mines_peru/app.R (the file below) and mines_peru/data/clean_active_mines.RDS.
...
1
vote
0
answers
36
views
Render Leaflet Map Layers Asynchronously in R Shiny
I am trying to reduce the loading time of a Shiny App that renders a map via the Leaflet package utilizing large sf object datasets. Much of the slow loading time is attributable to the actual ...
0
votes
0
answers
48
views
Polygon duplicated when using 'Cut layers'
I'm building a Shiny app using leafpm polygon editor. Basically I apply some changes to an existing polygon, then I save the edited polygons and edit the leaflet map by removing polygons and adding ...
0
votes
0
answers
43
views
Interactive R maps that work well on mobile, with inset AK and HI?
Issue: I need an interactive choropleth map of the US that will work well on mobile (ideally pinch-zoom), has a pop-up on tap/click, and has AK and HI set below. Plotly isn't it as you have to tap the ...
1
vote
1
answer
50
views
Change icon, color and marker color based on data in leaflet
I'd like to plot some data on a map wherein the icon shape, iconColor and markerColor are all based on the data itself.
Sample Code
library(data.table)
library(leaflet)
library(webshot2)
library(...
0
votes
0
answers
26
views
Getting Domain range Error using mapview function. Screenshot attached
Getting:
Error in leaflet::colorNumeric(palette = palette, domain = domain,
na.color = na.color) : Wasn't able to determine range of domain
Trying to attribute certain areas of map with a color
0
votes
0
answers
37
views
Ho to make markers have different colors based on specific variable in R using leaflet?
What I want:
I want to make markers appear with different colors
my map
will have radio button to control (show/hide) markers by variable
'color_status'
match color scale to the color of the markers -...
0
votes
1
answer
27
views
Leaflet circle markers are not adhering to my colorfactor palette?
I'm using a defined color palette in my circle markers to show the category of each point on the map.
The points that show up on the map are colored according to the palette but the palette does not ...
0
votes
0
answers
30
views
Leaflet overlayGroups cause circle markers to not be clickable
I'm working on a Leaflet map that will be part of a Shiny application. This map involves being able to click on a point to allow a plot to generate based on the input click. The map has an overlay ...
1
vote
1
answer
41
views
How to draw a custom map in the style of NASAGIBS.ViirsEarthAtNight2012 using R
"NASAGIBS.ViirsEarthAtNight2012" is an optional layer parameter under the addProviderTiles function in the leaflet and leafletCN packages.
I really like the drawing effect of this map.
How ...
0
votes
1
answer
31
views
on R studio for mac book, how do I make sure my map is laoding?
I am using Rstudio on my macbook, I want to run a geographical analysis. I have the leaflet library, and the required libraries overall. However, when i View(make_a_map) there is not a visual but name,...
0
votes
1
answer
63
views
Leaflet does not work with a specific basemap layer in R
I am recently working on a project. Its one dimension is to make a leaflet map with different basemap layers. Here is the code so far;
library(leaflet)
library(leaflet.providers)
leaflet() %>%
...
-1
votes
1
answer
60
views
Package warning
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/vctrs_0.6.5.zip'
Content type 'application/zip' length 1336614 bytes (1.3 MB)
downloaded 1.3 MB
trying URL 'https://cran.rstudio.com/bin/...
0
votes
0
answers
112
views
R Mapview and Leaflet render in quarto and shiny but not in Rstudio when with R 4.4.0
With the new update of R version 4.4.0, mapview and leaflet do not render in the viewer window of RStudio but do render when used in shiny applications or quarto documents.
These will preview fine in ...
1
vote
1
answer
36
views
How to use a Cicerone guide for elements of a leaflet map in R Shiny?
Using the Cicerone package, I am trying to create some guide steps for elements inside an r-leaflet map. I have tried a variety of CSS selectors I can think of from inspecting the elements and using ...
0
votes
0
answers
37
views
Fitting a Long Legend Within Mapview
I like what mapview outputs but can't really use it with with the burst option (seems to make legend interactive and zooms to group on click) as there's no way to adjust the scale of the legend. Is ...
0
votes
0
answers
33
views
Can I use Nearmap in leaflet via R?
I would like to know if it's possible to use Nearmap in leaflet via R?
If so, how can I do that?
I have access to Nearmap and can generate API key. I would like to use Nearmap as basemap.
I searched ...