1,682 questions
2
votes
1
answer
100
views
How do I reactively change legend values inside an R Shiny Leaflet map?
I'm working on an interactive mapping tool using shiny and leaflet which will allow users to navigate through various filters, basemaps, shapefiles, and point data. The problem I am running in to ...
3
votes
1
answer
123
views
R's leafem not appending Layers Control with customizeLayersControl(includelegends=T)
Working on a leaflet map with a large number of groups that creates a bulky legend. To trim down the legend, I'd like to hide it away in the Layers Control with customizeLayersControl from the leafem ...
3
votes
1
answer
89
views
custom size for addEasyprint with leaflet.extras2
I'm creating some html files for colleagues where they can explore a leaflet map interactively, then save a copy for presentations.
Unfortunately the downloads from addEasyprint in leaflet.extras2 are ...
2
votes
2
answers
118
views
Using leaflet in R shiny to zoom to a postcode entered by user
I've collected longitude/latitude coordinates of roads in Hertfordshire. I want the user to enter a postcode in the app, and for the app to center the map on that postcode. The map has dots for each ...
1
vote
2
answers
157
views
How to extract one row per combination of variables in a data frame
I have a database with longitude and latitude values that correspond to station names. Some stations have multiple entries with the same name. I need to group these stations by their name, so that all ...
1
vote
0
answers
97
views
TMAP v4: group.control Radio not working with Basemap and Potential Bug with special characters (german Umlaute = mutated vowels: ä,ü,ö)
I am trying to create some interactive tmaps. I wanted to take advantage of the radio buttons in TMAP v4, to display different data inside the same .html-file.
My first question is around using group....
0
votes
1
answer
64
views
What is the equivalent of onclick for textInput in R Shiny leaflet popup?
I'm working on a Shiny app with a leaflet map that allows users to change names of points using popups. The idea is that you can click on a point, see the name and edit its textInput. The problem is ...
1
vote
1
answer
92
views
How to save leaflet to html with same dimensions as mainPanel
I am trying to save a map in html format from a shiny app, however, the map is saved alright but the dimensions from the map displayed on my mainPanel are different than the saved map. I would like to ...
2
votes
1
answer
258
views
How to include a leaflet map in Quarto closeread document?
I'm making a Quarto document with the closeread "scrollytelling" extension. Right now, when I attempt to create a leaflet map from an R code chunk, the resulting HTML file does not show the ...
1
vote
1
answer
108
views
How to manage layer's zIndex?
How can I manage the zIndex of following map (see code) in R using RStudio and Shiny? I'd like to put on the top a mapPane programmaticaly (eg.: change "Sections" zIndex to 490). I found ...
1
vote
1
answer
132
views
How to tell mapshot not to crop leaflet or mapview maps
I recently noticed that every time I saved a leaflet map to file as PNG or PDF, my saved map boundaries are narrower than what my shiny app mainPanel is showing. I looked into the mapshot() arguments ...
1
vote
1
answer
99
views
How to save a leaflet or mapview map as pdf with actionButton
Trying to save a leaflet map to png works fine but when saving as pdf, it saves the file but the legend does not show the colors only text. Can someone let me know what am I missing? Example below and ...
5
votes
1
answer
311
views
Adding accessibility to a Leaflet map?
I'd like to make sure maps I create with the leaflet package have alt text that could be read by screen readers. Essentially add alt text to the whole leaflet map the same way you can for static ...
0
votes
1
answer
178
views
How to remove zoom and layers buttons from mapview or leaflet maps before saving to a file [closed]
How can I remove the zoom and layers buttons of mapview or leaflet? Below is a small shiny app that I found online, however, it does not remove the above mentioned buttons. The app opens but get an ...
2
votes
1
answer
145
views
How to print the current map while preserving data points
Two fold question: How can I avoid losing my data points while attempting to save a map with the downloadHandler shiny control? And I have 4 tiles to select from but it defaults to the first one all ...
4
votes
2
answers
88
views
Force initial zoom to truncate portion of the data
I'm working on generating several thousand static images out of leaflet maps. I would like the images to be zoomed in, so that a portion of the data layer is truncated, so that the plotted data extend ...
2
votes
2
answers
141
views
Changing size / aspect ratio of leaflet
I'm looking to produce a rectangular leaflet output (i.e., aspect ratio of ~0.7). My workflow is as follows: I'm creating static maps, to be saved to image files. Then, I'll use 2 map outputs shown ...
1
vote
1
answer
166
views
How to save leaflet map as png or pdf after zooming in [duplicate]
How can I save a map displayed on the main panel either as pdf or png? I am able to save the default map but if I zoom in or out it still saves the default map. How can I tell shiny to capture what's ...
0
votes
1
answer
235
views
Is there a light gray base map without labels for cities? [closed]
I'd like to use R and particularly ggplot2 to load a basemap that looks very similar to the ESRI light gray canvas.
The code below is pretty close, but it has the labels for different cities, and I'd ...
1
vote
1
answer
53
views
How to have iframe popups in leaflet for multiple groups?
I have a leaflet map with multiple data sources (ie different group arguments) and I want popup with plotly graphs to open when clicking on markers. I use leafpop:::addPopupIframes, saving widgets ...
1
vote
1
answer
78
views
Adding text title on top of leaflet within Shiny
I'm looking to add a little text blurb inside a leaflet map within Shiny. This answer works great for leaflet outside of Shiny, but I can't seem to find a solution to doing this within Shiny.
Toy ...
1
vote
1
answer
62
views
Synced leaflet in dashboard breaks with added tabs
This is a follow-up question to the excellent answer provided here on how to sync leaflet maps while using leafletProxy within Shiny. When I incorporate the provided answer into a dashboard with ...
3
votes
1
answer
155
views
leaflet panels in shiny (with animation and leafletproxy)
I'm working on a Shiny app that needs to have two maps showing the same area under 2 different scenarios (similar to facets in ggplot). The app has an animation, displaying the data over time, and ...
1
vote
1
answer
91
views
How to add subtitles in a Leaflet layer control of overlay groups?
I'd like to show subtitles in the control box for overlay groups of a leaflet map created in R. I found some examples (for instance https://github.com/ismyrnow/leaflet-groupedlayercontrol) but not ...
0
votes
1
answer
117
views
R leaflet with square / diamond, colour-coded points
I'm putting together a leaflet that is going to show several thousand points - a map of temperatures over the spatial extent of interest. Currently, the points are represented as diamond-shaped ...
3
votes
1
answer
102
views
Leaflet map in R Shiny shows white screen temporarily (on country click or first load)
Problem:
I'm building an interactive R Shiny app that uses leaflet to show a world map with country polygons and raster overlays (.tif) for each. Users can switch between the "World" view (...
2
votes
2
answers
148
views
How to mask the world except for one country using R and sf and show it in a leaflet map?
I want to display a leaflet map in R where the whole world is "whited out" except for a specific country (e.g., Germany). I had a working solution using sp, rgdal, and rgeos, but these ...
3
votes
1
answer
104
views
How to overlay a shapefile on leaflet minimap
I am trying to overlay a shapefile on the minimap using leaflet (addMiniMap). My code is below.
The small sample shapefile can be downloaded from here: https://login.filesanywhere.com/guest/fs?v=...
0
votes
1
answer
108
views
Zoom to selected province, add polylines from shapefiles, and highlight clicked marker
I'm building a Shiny app that visualizes rainfall data using a Leaflet map. Here's what I want to achieve:
1. Zoom to a Province When Selected
When a province is selected from a dropdown, I want the ...
3
votes
1
answer
118
views
How to modify scale bar font size in leaflet map
How can the font of scale bar be modified in leaflet? Example below of what I have tried without success:
library(leaflet)
library(htmltools)
# Create a basic Leaflet map
map <- ...
1
vote
1
answer
74
views
How to remove label borders in leaflet javascript
I was able to change the size of the circleMarker to a small green dot but the label white space and border covers my study area.
How can I remove the label mylabel borders leaving just the text. ...
1
vote
1
answer
134
views
How to add label to inset using addMiniMap in leaflet
I can add labels to the main leaflet window but can't figure out how to add a label to the inset map window. Consider the example below:
library(leaflet)
main_map_with_labels <- leaflet() %>%
...
1
vote
1
answer
57
views
How to add a custom map to addMiniMap?
I would like to use a different map in addMiniMap() than the main leaflet window. How can I do that? For example, I want to display CartoDB.Positron in the main window and Esri.NatGeoWorldMap in the ...
1
vote
1
answer
186
views
How to show graticule coordinates along axes in leaflet
Is it possible to add graticule tick marks and coordinates around the edges of a leaflet plot? Something like the screenshot below but with lon/lat values included? I looked online but did not find a ...
3
votes
1
answer
343
views
how to draw a compass on leaflet or mapview map
How can I add a compass control to my map? There used to be a function called addControlCompass in leaflet.extras I believe but is not there anymore. Does anyone know how to add a compass or an arrow ...
2
votes
1
answer
96
views
How to add popupmovable plugin to a leaflet map?
I'm using R shiny to build a web application for users to plot past and present data. Many of these data points are close together, so when the user opens the popups, they overlap. The user needs all ...
1
vote
1
answer
135
views
How to left-justify legend text in leaflet with reactive rasters?
I’ve created a shiny app with raster layers plotted over a leaflet map. The user selects which raster to show with two drop down menus: one to select the type of data (mean or SD) the other to select ...
2
votes
2
answers
173
views
Raster not visible in leaflet even though it is visible using plot()
I tried to add a raster file (stored in r_max) to my map.
r_max is a RasterLayer with values from about 0 to 5:
class : RasterLayer
dimensions : 180, 360, 64800 (nrow, ncol, ncell)
resolution : ...
1
vote
1
answer
73
views
Points not plotting in correct location on map
I am trying to map traffic data onto a map of Ottawa. I first convert to longitude and latitude before plotting using the leaflet package. The plots look okay, but everything seems to be shifted west ...
3
votes
1
answer
148
views
Communicate 2-ways between DT and leaflet
I have a Shiny app that contains a leaflet and a DT table. I'm using crosstalk so that if I click a row in the table, it highlights the respective point on the map. However, I'd like to have it work ...
1
vote
1
answer
62
views
Offset circles/radii produced by addCircles
I have a leaflet map (in a R Shiny application) with multiple circles/radii added as the centroid of a province.
What I would like to do is to slightly offset the circles/radii so they are not totally ...
0
votes
1
answer
132
views
Making layer-specific legends (hiding the legends of un-activated layers)
I am making a map that needs to have seven base layers on it. There are so many legends that they cannot all fit on the screen- which makes it necessary to add a feature of the map that makes it so ...
2
votes
1
answer
120
views
Adding Leaflet Map including LeafletProxy in R Markdown download in Shiny App
I'm attempting to create a Shiny app which includes a map, and a downloadable Markdown report which has a copy of that map. I'm using the mapshot package, since it has the option to remove the zoom ...
1
vote
1
answer
42
views
How to implement labels that only refer to the current location for spot icons?
I am using the following df:
df <- structure(list(name = c("name1", "name2", "name3", "name4"),
postcode = c("NE6 4AG", "YO12 4HG", &...
2
votes
1
answer
82
views
Why does adding markers in a Shiny app work for one map but not the other? [closed]
I downloaded two separate, similar but distinct shape files. They can be found here and here. The first file has filename "FED_A_FINAL_REPORT_BC.shp" and the second has filename "...
0
votes
1
answer
66
views
Clustering custom icons in Font-Awesome style
A previous topic:
https://stackoverflow.com/questions/75526891/custom-icons-in-font-awesome-style-r-leaflet?newreg=026c290b4abe44f58cc3d9a9bb490e39
I've been working through the same problem with my ...
0
votes
1
answer
51
views
Variables are not being passed to leaflet loop to generate maps
I am working on a R Shiny app. The user uploads his data file and it creates leaflet maps of the median values. The difficulty is that I need to generate maps for each variable, but that number can be ...
0
votes
1
answer
189
views
How can I read a WMTS into R Leaflet?
I want to load a WMTS into R Leaflet.
I've tried a number of variations on the file pathway, and also tried "addWMSTiles()" but so far nothing loads into the Leaflet map. I can load in the ...
1
vote
1
answer
99
views
Draw with Leaflet and Export
Problem
I've been working on a shiny app where the user can draw a single polygon and export as either a shapefile or geojson. What I can't seem to figure out is how to combine multiple polygons and ...
2
votes
1
answer
192
views
when you click on the tab that was hidden, the leaflet map is not displayed properly
EDIT: This is solved per my answer posted below, thanks to comment by ghybs.
In my actual code which has multiple UI inputs that change the data displayed on the map (some of those UI elements being ...