Skip to main content

All Questions

Tagged with
3 votes
1 answer
2k views

How to change clusterOptions to display pie charts in R leaflet?

Consider the breweries91 data from the leaflet R package. I have simulated an additional variable in the breweries91 dataframe that corresponds to two groups for breweries. The code below will ...
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
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 ...
6 votes
3 answers
5k views

Coordinates of current mouse position on leaflet map with shiny

I want to access the current mouse position in a leaflet map in shiny. When using shiny you can get the current coordinates of a click event using input$MAPID_click, which contains latitude and ...
10 votes
1 answer
544 views

Load Quarto html map data from json for Leaflet map generated in R

I have created a Quarto blog post which contains many leaflet maps, generated in R. As the data for each map is embedded within the html file, the file itself is very large. This is causing problems ...
0 votes
1 answer
108 views

leaflet search don't make a search

I'm want make a map for compare 2 coordinates for the same point. Are 1500 different points. DFINAL<- structure(list(ACCENUMB = c("G 2771", "G 2771A", "G 6386", "...
6 votes
1 answer
555 views

Customize highlight between between plotly figure and leaflet map

My goal is to link highlighting between a plotly figure in one panel and a map in the second panel. For my purposes, I want to select (highlight) data in one panel and have the selected data highlight ...
1 vote
2 answers
2k views

Generate random colors for leaflet map

Great R Gurus, I am struggling to find a way to randomly mix discrete colors for my leaflet map for a large number of observations. The problem is the following command put similar colors next to ...
3 votes
1 answer
519 views

R Shiny leaflet stop zoom on scroll and use ctrl + scroll to zoom the map & move map with two fingers on mobile?

I am creating 100 + leaflet maps in my shiny app. The maps are 100% of the width of the page, so when the user goes to scroll down the page it zooms the map but I would like it to continue scrolling ...
1 vote
3 answers
2k views

R leaflet package produces blank (grey) map [Ubuntu 14.04]

I tried out the examplecode from the leaflet package doc: devtools::install_github("rstudio/leaflet");library(leaflet) m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map ...
53 votes
2 answers
47k views

How to save Leaflet in R map as png or jpg file?

I'm using Leaflet package to create maps in R. It works perfectly. I can export maps in R with simply Export, but I need to export maps from script in R. My simple code is: png("test_png.png") (m <...
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 vote
2 answers
1k views

Cannot display mapview output after installing R 4.0.0

After I installed the R 4.0.0, I cannot display the mapview output in the viewer of RStudio. It would be great if someone can give me some hints to solve this. Here is an example code. library(...
2 votes
0 answers
216 views

modify icon size using iconCreateFunction in leaflet for R

Using the quakes data as an example and the code below, I wish to modify the icon size. I need to keep the rest of the code as unchanged as possible, I just want to make the icons smaller. Can anyone ...
2 votes
0 answers
498 views

Time series chloropleth in R Shiny / Leaflet

How do you animate a choropleth in RShiny over time using leaflet? I would like to animate the color of choropleths over time in Shiny according to their numeric value. Below is what I have tried, but ...
10 votes
1 answer
2k views

Show Different Legend When Changing Layer - leaflet

I'm trying to make my leaflet map show no legend when both layers are selected, and when only one layer is selected show that layer's legend. I found these solutions using Javascript: How to switch ...
0 votes
1 answer
41 views

Can't add WMS layer to R Leaflet

I want to make a leaflet map in R with this wms servic : https://data.geopf.fr/wms-r/wms?VERSION=1.3.0 It works well in QGIS but not with addWMSTiles. library(leaflet) layer="ADMINEXPRESS-COG-...
2 votes
1 answer
1k views

How to show path and distance on map with leaflet, shiny apps?

I would like to show the distance between two locations using the leaflet package in a shiny app. I don't know how to do it. A line should connect two points on a map and display the distance on it. ...
15 votes
3 answers
12k views

Leaflet Legend for Custom Markers in R

I have an R Shiny app that uses Leaflet to create an interactive map. On this map, a categorical variable is used to designate different kinds of points and is visualized using custom markers (...
1 vote
1 answer
3k views

Delete Polygon from Leafletmap R/Shiny

I draw a Polygon on a leafletmap which I use in a shiny app. Everytime an event is fired I want to delete the old polygon and draw the new one over it. That does not work - I assume I use layerId ...
0 votes
0 answers
23 views

R Leaflet - Problem Highlighting Features Underneath Layer

I am encountering a problem where I can't see highlighted features underneath a transparent top layer. I have a simple map setup, where I have a US county choropleth layer with a transparent US state ...
1 vote
1 answer
83 views

Is there a way to pop out a leaflet map in an R Shiny app into a new browser tab?

I'm making an R Shiny application that includes a leafletOutput map that maps certain datapoints from a filtered dataframe. Is there any way to expand that map to a full screen size in a new browser ...
1 vote
1 answer
886 views

Problems scaling map. Shiny + leaflet

I can't have "full screen" map in my shiny app, because when I used "100%" parameter, the map disappears... ui <- fluidPage( leafletOutput("mymap", height = "...
3 votes
1 answer
3k views

Vary label color in R Leaflet

I have a data frame with a binary variable and xy coordinates. I can map the data with Leaflet and vary the color of the markers for each variable, but I want to know if I can also vary the label ...
1 vote
1 answer
92 views

clusterOptions() displaying correct area of map but no markers or clusters

I am working on a Shiny app in R that creates a leaflet map and plots points. Plotting the points by themselves works fine. The issue arises when I try to implement even the most basic clusters. I can ...
1 vote
0 answers
64 views

Add time slider for a stack of rasters

I'm looking for a static HTML solution (no Shiny) to incorporate a timeslider for raster data in a leaflet. leaflet.extras2::addTimeslider() requires the data argument to be "a Simple Feature ...
0 votes
1 answer
233 views

Scrape leaflet map coordinates from a dynamic website

I am trying to scrape the marker coordinates from a website containing a leaflet map (osm data). I have been trawling the web for answers and it appears that a simple query to the parsed html will not ...
15 votes
1 answer
6k views

Click event on Leaflet tile map in Shiny

Is it possible to get the lat long from a click event in leaflet/shiny (in R) from the tile map? (i.e. NOT from any loaded markers, polygons etc). Just to show positional (lat/long) info i guess. I ...
0 votes
0 answers
54 views

How to offset addStaticLabels using mapview or leaflet

How can the labels be moved up, down or to the sides. direction and offset seems to be ignored. I would like my labels to be moved to the bottom. library(mapview);library(leafem) mapview(franconia) %&...
0 votes
1 answer
102 views

LabelOnlyMarkers in R Leaflet with specific colors

I want to build a leaflet map with CircleMarkers and LabelOnlyMarkers atop the circles. Labels and circles should have colors specified in a data.frame column. The following does what I want, except ...
1 vote
1 answer
194 views

Custom legend order in R leaflet

I created a leaflet map and now need to customize the order of the legend. By default leaflet alphabetizes the legend order. In the example below, I need the legend order to be (from top to bottom): ...
0 votes
2 answers
1k views

R Leaflet Limitations? Too much data?

I found a workaround for this that actually worked better for the project I was working on, but I'm still curious. I was creating some maps in R using the leaflet package. The code ran well, but I ...
0 votes
1 answer
61 views

Change leaflet marker fill color by group

In the example below, I have cities located on a leaflet map. I would like the fill color to be yellow for cities in Virginia and green for cities in North Carolina. How can I set the fill colors of ...
0 votes
1 answer
597 views

Multiple layers on TMAP

I have a dataframe looking like this: dataframe Id is the zip code and the columns go from 2015 to 2019. Link to download the database (with the .shp file needed to execute this program) library(...
0 votes
0 answers
50 views

Is there any way to expand polygon objects, just to make them touch each other graphically?

I created these shape objects through K-Means clustering but I want them to have touching borders without doing anything too manual. Any assistance would be great. Working with crime data and it doesn'...
0 votes
1 answer
60 views

Can leaflet layer controls be used to alter popup contents in a Shiny dashboard?

I am building a dashboard in R Shiny that includes a map rendered using R leaflet. There are popups associated with locations on the map and items in the popup are also used as layer controls. i.e., ...
0 votes
1 answer
55 views

Leaflet proxy in r only shows latest added Layer

I want to visualise the development of fatal traffic accidents and accidents with severe injuries on state and community level in a leaflet map. As a solution i use a shiny app with a radio button for ...
1 vote
2 answers
227 views

How to make small polygons from shapefile and extract coordinates

I have a small shapefile here: https://login.filesanywhere.com/fs/v.aspx?v=8c6d62865c626fb4a2ab called bay.RDS library(tmap) library(leaflet) library(mapview) bay <- readRDS('bay.RDS') mapview(...
0 votes
0 answers
87 views

Multipage flexdashboard leaflet map issues

I have created a multipage flexdashboard app (.Rmd) in R using shiny runtime. One of the pages is a leaflet map with a large polygon layer. The map initially draws as it should but after I browse ...
0 votes
1 answer
80 views

How to set an anchor and create polygons from shapefile

I am following up on the example here: How to make small polygons from shapefile and extract coordinates I am trying to adapt that example to a different shapefile but I am getting errors. The new ...
0 votes
1 answer
267 views

In R, how do I create a spatial grid using Leaflet and SF that is color coded based on some variable

I am working with some state in the United States. I have latitude and longitude data (comprising two different columns) and I have a third column, let's call it L1, containing a value from 1-10. I ...
0 votes
0 answers
92 views

WMS from password protected portal not loading in Leaflet on R - works fine in QGIS

After creating a few WMS, I have tried loading them in R to display them on a map but sadly the leaflet map doesn't show them - only the backdrop does. I had no issue displaying them in QGIS with ...
3 votes
2 answers
2k views

How to change NA values to NULL in a leaflet choropleth map?

I am trying to map a categorical variable that has NA values. I would like the NA values to appear as transparent on the map but they seem to show up as black. library(sf) library(leaflet) library(...
0 votes
1 answer
48 views

R Leaflet layer control fails when using clusterOptions

Layers control in this map work well: library(leaflet) mini_quakes <- head(quakes, 10) mini_quakes$stations <- as.character(mini_quakes$stations) leaflet(mini_quakes) %>% addTiles() %>% ...
1 vote
1 answer
572 views

Leaflet in R - Highlight Polygon on Click

Using the leaflet package in R, I'm looking to highlight / change fillColor of polygon upon click instead of hover. This is in a Shiny app, so I have access to the reactive values, and knowledge of ...
0 votes
1 answer
83 views

Having google search images as leaflet popup

Recently I have been working with the package 'leaflet' in R. I have already created my interactive map and so on, but I would prefer to style it up a bit. My program recieves a list of Cities ...
1 vote
1 answer
1k views

Dynamic labels on leaflet map (shiny r)

So I've been trying to add a functionality on my leaflet map in Shiny dashboard where the user would be able to choose what the popup label would show through an input checkbox statement (in this case,...
7 votes
2 answers
3k views

How can I remove attribution in leaflet map in R

I am working on a shiny application in R which involves maps generated with the leaflet package. I would like to remove the attribution from the map, or at least reduce the visible text. I tried to ...
1 vote
2 answers
118 views

R flexdashboard leaflet for loop

For a leaflet app, I have created multiple groups from my 'sf' polygon object based on an attribute value. Then I'm trying to use a 'for loop' to add these groups to the map, which is where the code ...
0 votes
0 answers
203 views

Leaflet map tiles don't load properly when displayed in flexdashboard tabsets

If I toggle between the tabs in the html file rendered from the following Rmarkdown file, Leaflet map tiles don't load properly. When I resize the html file, tiles show properly, but subsequent toggle ...

15 30 50 per page
1
2 3 4 5
38