Skip to main content

All Questions

Tagged with
1 vote
1 answer
466 views

Outline multiple polygons R leaflet to show territories

I am using leaflet in R to make maps with layers. I have the basics down but am new to geoJson and would like to be able to show grouped territories outlined. For example, I would like to group “...
park489's user avatar
  • 13
0 votes
1 answer
1k views

R: Converting Data Frames into Shapefiles

I am working with the R programming language. Suppose I have the following shapefile: library(sf) library(leaflet) library(leafgl) library(colourvalues) library(leaflet.extras) nc <- st_read(...
stats_noob's user avatar
  • 5,689
0 votes
0 answers
42 views

How to increase popup size in the R Leaflet library as per the count?

This is the dataframe named 'sellers_state_name_df' -> Dataframe What I want is to increase the popup size of the circles as per the 'Freq'. For e.g Acre (1) circle should be smaller in size than ...
Shaikh Rezwan Rafid Ahmad's user avatar
0 votes
2 answers
93 views

R Displaying Points Twice?

I have this code for an interactive map in R: library(leaflet) library(inlmisc) Long = rnorm(1000, -71, 0.5) Lat = rnorm(1000, 42.3, 0.5) loc = rep("loc", 1000) Name = rep("Location&...
stats_noob's user avatar
  • 5,689
4 votes
1 answer
824 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,689
1 vote
1 answer
70 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,689
1 vote
1 answer
373 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,689
1 vote
0 answers
695 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,689
1 vote
1 answer
349 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,689
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,689
1 vote
1 answer
984 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,689
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
  • 79
1 vote
1 answer
911 views

Create smallest grid in leaflet R

I want to create the smallest grid as possible in leaflet R. How should I go about it ? My current code is :- leaflet()%>% addTiles() %>% setView(lng = 101.9758, lat = 4.21053, zoom = 10)) %&...
Wawa's user avatar
  • 73
1 vote
1 answer
129 views

Extracting Intersect Values in R

I am wondering if there was a specific way that would allow me to extract the sa3_code_2016 from the QLD sf object and add each corresponding value to the test dataframe. Solved, needed to assign ...
k3r0's user avatar
  • 377
2 votes
0 answers
176 views

How can I use Leaflet (in R) to smoothly pan/zoom from one point to another point?

I am using flyTo() in leaflet (R), but I want to avoid how it zooms all the way out to world view before zooming in to the specified lat/lon. Is there a way to set the start point of the flyTo to ...
Julia Wagenfehr's user avatar
0 votes
1 answer
487 views

How to find correct projection of the shapefile data for leaflet map in r?

I am new to geo spatial data & trying to create choropleth map using leaflet & shapefile. I have tried to plot the data on leaflet map but getting an error: Error: Must supply x/y attributes ...
ViSa's user avatar
  • 1,717
0 votes
1 answer
4k views

How to trouble shoot "Don't know how to get path data from object of class standardGeneric" with leaflet

I am trying to create a map showing generation capacity by county with leaflet. There can be multiple generating units per county, but I thought that would not be an issue for mapping county capacity. ...
bgcorbett95's user avatar
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 ...
pkpto39's user avatar
  • 545
0 votes
1 answer
112 views

changing data based of leaflet shiny input

I would like to change data to plot on a shapefile (world) based on the year selected as input. According to you, which one is wiser: Setting the data to wide (data_2020, data_2019, data_2018...) and ...
krasnapolsky's user avatar
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
1 answer
386 views

Add `RasterLayer` to `addLayersControl` in leaflet

I have to RasterLayer-objects (raster1 and raster2) in R. And I want to add them both to a leaflet-map. I also wanted to have the option to show or hide them. So I thought I'd add them with their ...
Lenn's user avatar
  • 1,433
0 votes
1 answer
207 views

Combining Spatial Dataframes with different columns

I have three different spatial dataframes that I'm trying to combine as one big one. The reproducible code looks like this: library(sf) library(sp) library(leaflet) library(tigris) library(rgdal) ...
user avatar
4 votes
2 answers
4k views

Converting data.frame to SpatialPolygonsDataFrame

Here is the data for reproducible purposes: structure(list(countyfp10 = c(1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7), id = c(7417, 7418, 7419, 7420, 7421, 7422, 7423, 7424, 7425, 7426, 7427, ...
user avatar
0 votes
1 answer
43 views

Change map colourfill based on user selection

It's been a while since i'm having this problem. My current shiny app is not able to communicate with the user selection. It is supposed to show a colour fill variation across different region when a ...
Aeiyuni Husna's user avatar
4 votes
1 answer
958 views

How to rotate symbols (representing spatial point data) based on feature with tmap and sf?

I want to represent 2 ships on a map in an interactive way (leaflet based method) with some of their metadata as well. Naturally, metadata of a ship usually contains the heading of the vessel and the ...
Alex Karvouniaris's user avatar
5 votes
1 answer
5k views

time slider with leaflet/ R

I am currently working in R and I am using leaflet package to vizualize geospatial data, I would like to make an analysis over the time and display my map given a time slider In R there is the ...
Tess's user avatar
  • 129
0 votes
1 answer
2k views

Leaflet (R) addPopups: coordinates/properties

I'm fairly new to handling spatial data and leaflet in general. I'm having difficulty creating a popup for my map. Basically what I want in the popup is the coordinates of my polygon and one of the ...
fletchr's user avatar
  • 636
1 vote
0 answers
171 views

How to match color scheme of spatial lines, circle markers in R leaflet

I'm wondering how I can color GPS locations and tracks that are created from a sequential order of points in leaflet. I've figured out how to color the circle markers by a grouping variable (TagID), ...
Jason's user avatar
  • 912
1 vote
2 answers
664 views

How to make dynamic labels from a spatial polygons dataframe for Polygons on a Leaflet map in R

With this script, I am displaying a map with three isochrones. I would like the map to have labels containing the max time represented by each isochrone/polygon. How should I reference the spatial ...
Claudio Paladini's user avatar
0 votes
1 answer
799 views

Empty SpatialPolygonsDataFrame object passed and will be skipped at Shiny

I am sorry for cumbersome code in advance, but need some good help. I will start from printscreens So, 5 out of 6 filters in my Shiny app work perfectly: The problem arises when I try to create the ...
Anakin Skywalker's user avatar
0 votes
1 answer
84 views

Derived spatial lines pointing to incorrect polygons

I'm currently trying to make a flow map in leaflet for R to map the movement of something from one area (polygon) to another. library(sp) library(rgdal) library(tidyverse) library(leaflet) I'm ...
Nick's user avatar
  • 849
2 votes
0 answers
864 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
816 views

R - Leaflet Code "Error in mutate_impl(.data, dots) : object 'address.lon' not found"

I'm trying to re-appropriate a Leaflet code I used six months ago, with which I had no problem at the time. I haven't used Leaflet since then and am now no longer able to generate maps like I was ...
Bradley Thomas Anderson's user avatar
3 votes
2 answers
1k views

how to plot multiple isochrone on leaflet map in R

i can plot one isochrone in R at a time using Rmapzen package with this code, each isochrone is generated as a sp object, is there any way to create multiple isochrone on the same map like the ...
santoku's user avatar
  • 3,417
5 votes
2 answers
6k views

How to plot country-based choropleths using leaflet R

World boundaries geo.json downloaded from here.https://github.com/johan/world.geo.json I am trying to highlight 3 countries(in a world map view) and paint them in gradient color according to numbers ...
Daisywang's user avatar
  • 297
6 votes
2 answers
14k views

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 ...
Omlere's user avatar
  • 263
1 vote
0 answers
497 views

R add json string with polygons to leaflet

I would like to intergrate a couple of polygons into my leaflet map. These polygons are written in WKT. By using the package wellknown i convert them to a geosjon format InstallCandidates <-c("...
M. Kooi's user avatar
  • 255
2 votes
1 answer
4k views

Animated marker moving and/or path trajectory with Leaflet and R

I am very excited the spatial abilities of Leaflet combined with R but I badly need the possibility to move around markers and/or draw paths over maps. As far as I see the Leaflet R package lacks this ...
Hendrik's user avatar
  • 1,168
1 vote
1 answer
1k views

Display Line on Leaflet

I want to display a line on a leaflet (for R) map. The points of my line: myPoints < - structure(list(lat = c(52.40684, 52.40682, 52.40681, 52.40679, 52.40675, 52.40669, 52.40668, 52.40661, 52....
four-eyes's user avatar
  • 11.9k
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