Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
20 votes
2 answers
29k views

leaflet with R: add text labels

This code is taken from this page: library(leaflet) leaflet(data = quakes[1:20,]) %>% addTiles() %>% addMarkers(~long, ~lat, popup = ~as.character(mag)) Instead of markers, is there any way ...
luciano's user avatar
  • 13.7k
5 votes
2 answers
1k views

R: Connecting Dots on a Map

I am working with the R programming language. Using the "leaflet" library, I made the following map for these 5 cities: library(dplyr) library(leaflet) map_data <- data.frame("Lat&...
stats_noob's user avatar
  • 5,705
5 votes
1 answer
3k views

Add "rgb" legend to R leaflet heatmap

I made some interactive heatmaps using leaflet (particularly the addHeatmap() command from the leaflet.extras package) and shiny. Having created a desired map, I would like to add a legend to it. ...
Crimmlaz's user avatar
4 votes
1 answer
827 views

Customizing Leaflet Map Icons in R

I started to learn how to use the search features in leaflet maps - below is a leaflet map which allows you to search for a city (i.e. single search term): library(leaflet) library(leaflet.extras) ...
stats_noob's user avatar
  • 5,705
3 votes
2 answers
740 views

Combing Leaflet Maps Together

I generated these 2 random dataset about geographical coordinates (e.g. each point represents an imaginary restaurant in France): id = 1:1000 long = 2.2945 + rnorm( 1000, 0.1085246 , 0.1) ...
stats_noob's user avatar
  • 5,705
2 votes
0 answers
187 views

Restricting Zoom Options in Leaflet Maps

I followed the tutorial here (https://rstudio.github.io/leaflet/) and made this map: library(leaflet) m <- leaflet() %>% addTiles() %>% # Add default OpenStreetMap map tiles addMarkers(...
stats_noob's user avatar
  • 5,705
2 votes
0 answers
865 views

leaflet legend for Custom Awesome Marker in R?

I need to add some custom marker legends to my leaflet map. So far, the closest solution I found is this. According to the solution in the link, I need to use the addControl() function. First I ...
user3498115's user avatar
1 vote
1 answer
470 views

Adding geographic polygons via readOGR / addPolygon() with Leaflet in R

I've been following this tutorial, but for some reason I can't seem to get these borough polygons to show up in leaflet. If I do plot(boroughs) everything works fine, you can clearly see the ...
skathan's user avatar
  • 659
1 vote
1 answer
375 views

Simulating Geographical Points Around the Eiffel Tower

The coordinates of the Eiffel Tower are (Longitude: 48.8584° N, Latitude: 2.2945° E). I am interested in randomly generating 100 points that are located within a 12 KM radius of the Eiffel Tower. In ...
stats_noob's user avatar
  • 5,705
1 vote
1 answer
350 views

R: Joining Maps Together

I am working with the R programming language. Using the "leaflet" library, I made the following 3 maps: #load libraries library(dplyr) library(leaflet) library(geosphere) library(leafsync) ...
stats_noob's user avatar
  • 5,705
1 vote
1 answer
993 views

R: Making More "Noticeable" Labels in R Leaflet map

I made the following map in R (from a data frame with 5 points ordered from "1" to "5"): library(dplyr) library(leaflet) map_data <- data.frame("Lat" = c(43.6426, 43....
stats_noob's user avatar
  • 5,705
1 vote
1 answer
573 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 ...
Sean's user avatar
  • 125
1 vote
1 answer
71 views

Replacing "rdgal" with a Data Frame in R?

I found this R code (Search button for Leaflet R map?) and was able to make a interactive map in R: library(inlmisc) city <- rgdal::readOGR(system.file("extdata/city.geojson", ...
stats_noob's user avatar
  • 5,705
1 vote
1 answer
197 views

Adding "Breaks" in "htmlescape"

I am following this tutorial here (https://rstudio.github.io/leaflet/popups.html): library(htmltools) library(leaflet) df <- read.csv(textConnection( "Name,Lat,Long Samurai Noodle,47....
stats_noob's user avatar
  • 5,705
1 vote
1 answer
124 views

Map vector group in specific order - R leaflet

I have a shapefile with polylines of routes in different years. Here is an example data shapefile with routes in the year 2000 and year 2013. I would like the map to show the older routes at the top ...
lenlen's user avatar
  • 69

15 30 50 per page