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

All Questions

Tagged with
1 vote
1 answer
576 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
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
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
0 votes
0 answers
68 views

Saving Multiple HTML files in R

I am following this R tutorial here (towards the end of the page) : https://glin.github.io/reactable/articles/examples.html. I would like to make an interactive map that allows you to filter points on ...
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
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
1 vote
1 answer
27 views

Is "knitr" required for certain outputs in R?

I am trying to follow this post on stackoverflow (R Leaflet: Add a Range Slider to Filter Markers without Shiny). I copy and pasted the code below: library( crosstalk ) library( leaflet ) library( ...
stats_noob's user avatar
  • 5,705
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
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
0 votes
0 answers
175 views

Merging Information into a Shapefile

I have a shapefile ("my_shapefile") in R. Part 1: If I try inspecting this shapefile and check its contents by adding a "$" - there appears to be 3 parts: head(my_shapefile$var1) ...
stats_noob's user avatar
  • 5,705
1 vote
0 answers
696 views

Learning How to Use Shapefiles in R

I am trying to learn more about "shapefiles" and how to plot them in R. Ideally, I would like to make a "leaflet map" (interactive or static) that looks something like this: https:...
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
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
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
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
0 votes
0 answers
238 views

R: Understanding the "max" and "blur" options

I am working with the R programming language. Using the following code, I made an interactive map with the "leaflet" library : Lat = round(runif(5000,43,44), 4) Long = round(runif(5000,79,80)...
stats_noob's user avatar
  • 5,705
0 votes
0 answers
107 views

Can I create an embed code for an interactive choropleth map made using the leaflet package in R?

I'm new to R. I've just made a basic interactive choropleth map using the leaflet package in R: leaflet() %>% addProviderTiles("CartoDB.Positron") %>% setView(-2, 55, zoom = 5) %&...
TL_13's user avatar
  • 1
1 vote
1 answer
525 views

Interactive choropleth map with leaflet inaccurately mapping data

First post, I'll try to do my best. I'm trying to make an interactive choropleth map with leaflet in R, based off this tutorial. It all goes great until I compare the data represented on the map with ...
Ziemowit Bućko's user avatar
0 votes
0 answers
152 views

how to add polygons in shapefile in R

I have a few building data in shapefile. Now I want to add some small circules/rectangles/anything suitable to represent the lighting poles beside the building. How could I do that in R. Currently I ...
Yang Kewen's user avatar
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
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
0 votes
1 answer
128 views

Leaflet package in R: why are the labels misplaced when plotting them with noHide=T?

I am trying to plot gas stations in Spain, and I would like the plot to show the names or brand names of each station. So far I have struggled a little bit with this, but I finally got my way around ...
Miguel M.'s user avatar
  • 251
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
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