Questions tagged [r-leaflet]

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

499 questions
2
votes
1 answer

Shiny Leaflet map with conditional logic doesn't render initial map markers

I'm building a Leaflet map using Shiny and Flexdashboard. The map is hidden behind introduction text using conditional panels. It loads for the first time after the user makes a selection from an input. The initial output$map should only load once…
Jeff
  • 209
  • 1
  • 10
2
votes
1 answer

How to add multiple polygons in leaflet map using r loop?

I'm trying to add multiple polygon to leaflet world map, according to a number of lists of country code. And I was trying to use R loop to add the polygon. Here's the code that I manually add polygons from list…
Daisywang
  • 287
  • 3
  • 17
2
votes
2 answers

R leaflet - cannot export map

I plot a route on a map using R and leaflet : ct <- read.csv("fl1.csv", stringsAsFactors=FALSE) m <- leaflet(ct, incl.data=TRUE) %>% addTiles() m %>% addPolylines(~longitude, ~latitude, color = "red", weight = 4 RStudio plots exactly what I…
erculeo
  • 31
  • 5
2
votes
0 answers

using Leaflet.TextPath in R

I would like to plot a Polyline using R's leaflet package. This Polyline is supposed to have arrows alongside the line to illustrate that the Polyline has a time dimension. There's a plugin for leaflet.js that implements this feature by printing…
RoyalTS
  • 9,545
  • 12
  • 60
  • 101
2
votes
0 answers

Why does the R leaflet documenatation recommend making a new function for color palette?

Much of the documentation for R leaflet's color palette function suggests creating a new function (usually pal(). See, for example,: the last example at https://rstudio.github.io/leaflet/markers.html most of the examples at…
crazybilly
  • 2,992
  • 1
  • 16
  • 42
2
votes
0 answers

Is there an equivalent of the pointToLayer function in the R leaflet library

I am new to leaflet and R. I am trying to create interactive maps with R (leaflet and shiny). I basically need to trace a route with points on a map. the data comes from a GeoJSON file with properties which need to be used for style options. An…
VinayakR
  • 33
  • 1
  • 5
1
vote
1 answer

Subset data based on leaflet click action in a shiny app

Im trying to subset the df dataframe based on the click of the selected county in the leaflet map above but I get an empty table. library(shiny) library(leaflet) library(sp) library(rgdal) # Make sure you have this package installed # Sample…
firmo23
  • 7,490
  • 2
  • 38
  • 114
1
vote
0 answers

Output flexdashboard with renderLeaflet to html

I have flexdashboard code that works when I run it within RStudio (using the "Run Document" button and viewing in RStudio's viewer - and also when clicking the "Open in Browser" button in viewer, it opens a system browser and works fine). However,…
jdev
  • 25
  • 2
1
vote
1 answer

R Shiny Leaflet map with checkboxGroupInput only displays two markers at a time

I'm trying to code an app that allows users to select multiple groups of points via checkboxGroupInput and have a leaflet map display the associated points with corresponding lat/longs. My dataframe is as follows: x3 = structure(list( species =…
1
vote
0 answers

Hiding the background from the leaflet map (i.e., Canada, Mexico) in r shiny

I have created the below map within the Shiny app context. I wonder how can I modify the code such that only US boundaries are shown (i.e., I want to hide Mexico, Canada, etc.). Below is the part of the code which I believe needs to be modified. …
Nader Mehri
  • 514
  • 1
  • 5
  • 21
1
vote
0 answers

How to remove white space above and below leaflet map on Quarto website

I am using Quarto to develop a website featuring a leaflet map. I'm not sure how to remove the white spaces above and below the map on the webpage: Screenshot This should ideally take up the entire space between the header and the footer. Details of…
1
vote
0 answers

Client side linking leaflet choropleth with plotly R

I am trying to link a choropleth map generated using leaflet, with a bar chart from plotly. I want them to be linked client-side, i.e. not via Shiny. The behaviour I would like is that when one hovers or clicks on a bar of the bar chart, the…
Will
  • 381
  • 2
  • 12
1
vote
0 answers

Leaflet for R: Is there a way to add an outline to minicharts pie charts and barplots?

I'm using leaflet in R to visualize pie charts and bar plots on a map. I am using the following code to create the maps (example shown for pie charts): data = data.frame(site = c("site1", "site2"), lat = c(42.6076, 43.7452), lon =…
nrcombs
  • 503
  • 3
  • 17
1
vote
0 answers

Display multiple search results in R leaflet

I have built a leaflet with circlemarkers and labels. I addes a search feature using addSearchFeatures. I have 100+ locations and each location is associated with a person's name. One person can be associated with more than one location. I would now…
riri
  • 11
  • 2
1
vote
0 answers

Error in menuSubItem shiny r: Error in leaflet::JS(callback) : The arguments for JS() must be a character vector

Im struggling on creating a basic shiny app because of an error. I have found the error, witch is the menuSubItem where on any simple task the console sends: Error in leaflet::JS(callback) : The arguments for JS() must be a character vector I´ll put…