Questions tagged [r-leaflet]

This R package makes it easy to integrate and control the open-source JavaScript Leaflet software in R.

499 questions
7
votes
2 answers

How to save a leaflet map in Shiny

Following on from this question, I am looking to save and download a leaflet map as a png or jpeg image. I have the following code but I keep getting an error. ui <- fluidPage( leafletOutput("map"), downloadButton("dl") ) server <-…
nathaneastwood
  • 3,664
  • 24
  • 41
6
votes
1 answer

leaflet side-by-side for 2 raster images in R

{leaflet.extras2} implements the leaflet side-by-side plugin and provides this minimal example: library(leaflet) library(leaflet.extras2) leaflet(quakes) %>% addMapPane("left", zIndex = 0) %>% addMapPane("right", zIndex = 0) %>% …
Rich Pauloo
  • 7,734
  • 4
  • 37
  • 69
6
votes
1 answer

R & Leaflet: how to bind a client-side event to a polygon

Here is a simple shiny app: library(shiny) library(leaflet) nc = sf::st_read(system.file("shape/nc.shp", package="sf")) ui <- function(request){ tagList( selectInput("color", "color", c("blue", "red", "green")), leafletOutput("map") …
Colin FAY
  • 4,849
  • 1
  • 12
  • 29
6
votes
2 answers

Pie charts in R leaflet, turn count into sum and control more the size

I am fascinated by the solution of grouping markers and presenting counts by groups in form of small piecharts https://stackoverflow.com/a/60525137/3480717 I am R only and do not know JS. I would like the code to sum values from each data point and…
Jacek Kotowski
  • 620
  • 16
  • 49
6
votes
1 answer

Why does addPolylines work differently on an R Shiny leaflet map?

I have R code which creates a leaflet map with points connected by addPolylines(). library(shiny) library(leaflet) station = c("A", "B", "C", "D", "E", "F") latitude = c(-1.63, -1.62, -1.62, -1.77, -1.85, -1.85) longitude = c(34.3, 34.4, 34.7,…
AJGL
  • 303
  • 3
  • 9
6
votes
5 answers

Flow map(Travel Path) Using Lat and Long in R

I am trying to plot flow map (for singapore) . I have Entry(Lat,Long) and Exit (Lat,long). I am trying to map the flow from entry to exit in singapore map. structure(list(token_id = c(1.12374e+19, 1.12374e+19, 1.81313e+19, 1.85075e+19, 1.30752e+19,…
Prasanna Nandakumar
  • 4,295
  • 34
  • 63
6
votes
2 answers

Draw a map of a specific country with leaflet

I would like to use the package leaflet with R to draw a map of a specific countries such as Italy, Spain, etc. I checked the basic examples with the function setView() and I tried to give a vector of two values for the arg of latitude and…
Omlere
  • 263
  • 1
  • 2
  • 10
5
votes
0 answers

Zoom shiny leaflet world map to full width

Does anyone know how to set default render zoom of a Shiny Leaflet map so a full world map zooms to fit the window width (i.e. -180° to 180° properly fits the window)? I can only set zoom to integers, with 2 being too small and 3 too big. …
geotheory
  • 22,624
  • 29
  • 119
  • 196
5
votes
0 answers

Using SelectAreaFeature plugin with Leaflet for R

I am trying to use the SelectAreaFeature Leaflet JS plugin with Leaflet for R. I have had success using other Leaflet JS plugins, but not the SelectAreaFeature plugin. Here is an MRE (requires the SelectAreaFeature js…
fifthace
  • 506
  • 1
  • 10
  • 33
5
votes
0 answers

How to project a raster + polygons in Lambert 93 with leaflet on R?

I'm trying to make a leaflet map in Lambert 93 (st_transform(2154)) composed of: 1. Polygons (France) 2. Raster Layer (Europe) I can't understand why the following code is not…
antuki
  • 236
  • 2
  • 9
5
votes
1 answer

Displaying a loading spinner on a map when updating with leafletProxy in Shiny

The 'shinycssloaders' package was developed as a simple wrapper to provide loading icons to UI output, which works great. Unfortunately, it does not work for maps that are updated via leafletProxy (only the initial map produced will use a loading…
bwc
  • 1,028
  • 7
  • 18
5
votes
1 answer

Change figure of addLayersControl in leaflet

I'm wondering if there is a way to replace the symbol of addLayersControl in leaflet to something else more customized or even a title.
Marie-Eve
  • 565
  • 4
  • 15
5
votes
3 answers

how to set zoom level/view of leaflet map

I have a map in leaflet in RShiny which have markers plotted and once I click a marker it adds circles to map showing all the related points to the marker. What I want to do is to set zoom/view of the map in such a way that all the related circles…
Awais Hassan
  • 81
  • 1
  • 2
  • 6
5
votes
1 answer

Leaflet Layer Tiles not switchable when .html (= .Rmd output) is opened with browser

For several days now, the basic layer tiles "OSM" and "Stamen.TonerLite" (which I've been using for over a year as standard tiles for my maps) are not shown correctly – i.e. it's not possible anymore to switch between them. As long as the map is…
MichiSmith
  • 317
  • 1
  • 7
4
votes
1 answer

When using Leaflet for R, how can I change font size of the OpenStreetMap basemap?

I am creating maps for offline use using Leaflet for R and OpenStreetMap, adding information such as points of interest, and saving them as png files. This works well, but I would like to be able to adjust the font size on the OpenStreetMap basemap…
SlowLearner
  • 7,907
  • 11
  • 49
  • 80
1
2
3
33 34