Skip to main content

Questions tagged [leaflet-r]

Questions referring to the Leaflet R package.

Filter by
Sorted by
Tagged with
0 votes
1 answer
121 views

Displaying layer marker only after feature found with search plugin in Leaflet

I have been playing with different Leaflet plugins. One I am especially interested in is the Leaflet search plugin (https://github.com/stefanocudini/leaflet-search). I have been able to implement it ...
Bfox's user avatar
  • 1
2 votes
0 answers
93 views

Unwanted different line thickness in multipolygon's shared borders

I have a multipolygon in a Leaflet map in a R Shiny app. There is always one subpolygon selected to be displayed while the other subpolygons are hidden (i.e. it's fill is transparent and the others ...
bathyscapher's user avatar
0 votes
0 answers
91 views

R Leaflet throwing "matrix(): subscript out of bounds" with an addGeoRaster object

I am trying to render a large GeoTIFF (meter-scale urban land cover or MULC from the EPA EnviroAtlas found here) in Leaflet along with other spatial data. Because of the size (approx. 65k x 80k) I'm ...
jlamb's user avatar
  • 1
0 votes
0 answers
95 views

How do I get the proper data format for creating a tilegram -- from MULTIPOLYGONS to POLYGONS

I want to create a cartogram(specifically a tilegram like this) using data from GADM and population figures as the subject variable. Step 1: Get a json data file from GADM germany_1 <- read_sf(&...
ma991ng's user avatar
  • 113
1 vote
1 answer
372 views

Append more variables to a SpatialPolygonsDataFrame using R

I would like to generate a SpatialPolygonsDataFrame that I can use to plot a cartogram whose polygons are proportional to a variable. A clear example is how FiveThirtyEight created a hex cartogram ...
ma991ng's user avatar
  • 113
1 vote
0 answers
256 views

Poor GeoTIFF display performance using JS plugins contrary to Leaflet for R package

I have question regarding displaying GeotTIFF using leaflet or react-leaflet. There are some packages allowing displaying tiffs, for example I had used: https://github.com/stuartmatthews/leaflet-...
gikdeb's user avatar
  • 35
2 votes
2 answers
447 views

Can't add WMS layer to R Leaflet

I am building a Shiny app which should display environmental layers on a Leaflet map, and I'd like some of them to be pulled from the Environment Agency's (UK) WMS service. I can view the layer in ...
Sandy AB's user avatar
  • 530
0 votes
1 answer
2k views

How to read a dataframe and show it on leaflet

I am trying to show the data that I have in a data frame on a map by using leaflet library, but not sure how. geom <- c('LINESTRING(174.7698950000 -41.3435950000,174.7698040000 -41.3434660000,174....
Mohsen Sichani's user avatar
1 vote
0 answers
847 views

Text size is too small in Mapbox style in R Leaflet map

Does anyone have any experience with mapbox basemaps in R leaflet? The font is too small on my map. I have tried to change the zoomOffset and tileSize as detailed in this question, and in the ...
william3031's user avatar
1 vote
0 answers
204 views

Leaflet in R Shiny -- Custom Color Ramp for Tiled Data?

I have large-ish grids (roughly 9000 x 9000 cells) of model results in single-band GeoTIFFs (re-projected from raw outputs in FLT in a different coordinate system). I am displaying them over a tiled ...
TomEvans's user avatar
1 vote
1 answer
641 views

R - not the same number of raster cells after reprojection

I have a raster projected in EPSG:21781 (available here) that I'd like to display with mapview. Raster values correspond to the grid id, and need to be preserved. If I understood correctly, mapview is ...
Ervan's user avatar
  • 41
2 votes
0 answers
648 views

Leaflet Cluster Number as Variable [closed]

I'm looking to make a map using Leaflet in R, where the clusters shows the sum of a variable associated with the markers, instead of the number of markers in the area. For example: If there are 4 ...
Jimmi Chips's user avatar
5 votes
1 answer
2k views

Shiny leaflet click-event returns NULL when clicked again

When leafletProxy() is used, the click event of leaflet returns NULL when a polygone is clicked for the second time. How can I prevent it from doing so? Example code: library(shiny) library(...
JdP's user avatar
  • 187
1 vote
1 answer
1k views

No applicable method for 'metaData' applied to an object of class "NULL" with Leaflet map

I'm putting together a Shiny app that involves a Leaflet map. Unfortunately, whenever I run it, it produces this error: "no applicable method for 'metaData' applied to an object of class "NULL"". I'm ...
gooponyagrinch's user avatar
2 votes
0 answers
376 views

How to use addImageQuery from leafem package with leafletProxy() in R shiny app

I'm writing a shiny app that generates a raster based on user input, and I would like to add this raster to a leaflet map and then have the raster values be displayed using addImageQuery from the ...
Gopal Penny's user avatar
1 vote
0 answers
1k views

Setting up leaflet map in R using if/else if/else filtering

I'm trying to put together a map for work. Right now, the script looks as such (The shape file data can be downloaded here): library(tigris) library(mapview) library(leaflet) library(sf) library(...
LeTigris's user avatar
3 votes
1 answer
448 views

Cannot plot OSM data retrieved from R package 'osmdata' with leaflet directly

I am using the R package osm_data to retrieve some polygons. If I want to plot them using leaflet, it does only work if I export the polygons to a shapefile and re-import it, but plotting it directly ...
telegott's user avatar
  • 185
4 votes
1 answer
505 views

Standard for publication-ready R-based geographic images?

I've been using the ggmap package to create figures that will go in journal articles for many years. These maps are a little harder to create than Leaflet maps, and as OpenStreetMap and Google have ...
gregmacfarlane's user avatar
1 vote
0 answers
765 views

Plot overlapping buslines (polylines) with leaflet in R

Long story short: I´d like to plot bus lines on my GeoJSON data with Leaflet but need to get rid of the overlap. I´ve been skimming the forum for an answer to my question but, haven´t found any yet. ...
Alexander_Röhrs's user avatar
3 votes
1 answer
274 views

Identifying grid number by lat, long

I have created a 1km * 1km grid in QGIS using the MMQGIS plugin and below is a sample of shp@data and the layer Is there a way to do a spatial join on the grid created? I assume some grids should ...
EricA's user avatar
  • 143
2 votes
0 answers
979 views

Specifying EPSG:31370 CRS in R Leaflet for WMS-service returns blank tiles

I am trying to load historical map tiles from a WMS-server (GetCapabilities) and display them using R Leaflet. Using the default CRS in Leaflet works fine, using e.g.: leaflet() %>% setView(4....
mhermans's user avatar
  • 335
5 votes
0 answers
2k views

Selecting and deselecting markers in leaflet under R shiny?

I would like to write a script that selects a marker on the map whenever I click on it and then deselect it when I click/select another marker (that is, so that no more that one marker is selected on ...
Denys D.'s user avatar
2 votes
1 answer
1k views

Rearrange plotorder of SpatialPolygonsDataframe

I have a SpatialPolygonDataframe (loaded with readOGR) I want to plot in either tmap or leaflet. A lot of the polygons are overlapping, and the smaller polygons are completely covered by larger ...
IJH's user avatar
  • 21
2 votes
1 answer
5k views

Conditionally adding markers to map in R leaflet and shiny

I am trying to add some markers to a leaflet map in R based on conditions that I select from an selectInput command. The selectInput command lets the user choose three different numbers (1, 2 or 4). ...
redshoe's user avatar
  • 437
2 votes
1 answer
2k views

How to create independent/fixed inset maps with leaflet?

I am trying to create a leaflet map of the USA focusing on the contiguous 48 states and then add two inset maps of Alaska and Hawaii on the side. The problem is that addMiniMap() option creates an ...
Denys D.'s user avatar
4 votes
1 answer
2k views

R leaflet set zoom level of tiled basemap (ESRI World Imagery)

I need to define the maximum zoom level of a tiled map in R leaflet. The problem is that I have points that are placed very close to each other and I would like to be able to distinguish each of them ...
redshoe's user avatar
  • 437
2 votes
0 answers
4k views

Adding polylines to leaflet map in R

I am trying to add great circle routes between various regions in R. Here's the sample data: structure(list(CommencingRegion = c("RedSea", "EastAfrica", "GulfofMexico", "FarEast", "RedSea", "...
Dhiraj's user avatar
  • 171
3 votes
1 answer
3k views

Adding color to polylines in leaflet in R

I have had a look at this and other links therein. This is exactly what I am trying to achieve and failing. Here is some sample data: structure( list( lat = c(51.88783,51.8878441,51.887825,51....
Dhiraj's user avatar
  • 171
2 votes
1 answer
8k views

Displaying several data rows in popup using Leaflet for R?

While trying to map some quantitative data with leafletin R, I manage to place pie-charts with leaflet.minichartson the map, like in the following example: ### data ### d <- structure(list( ...
Peter's user avatar
  • 65
4 votes
1 answer
5k views

R leaflet - Bring base layer labels to front

I want to use a base layer so that my filled polygons are in geographic context. However, my polygons have simply gone over the top of the base layer and therefore only bits and pieces of place names ...
Henry Dark's user avatar
1 vote
1 answer
2k views

Highlight Borders When Mouseover Fill Area - Leaflet-R

Following the guidance of TimSalabim I separated the borders and fill of my neighbourhood polygons so that I could order them appropriately with zIndex. https://lawsblog.netlify.com/post/leaflet-map/ ...
ixodid's user avatar
  • 433
5 votes
1 answer
5k views

Order of Vector Layers in Leaflet-R

Here is a leaflet map in R https://lawsblog.netlify.com/post/leaflet-map/ The white lines are neighbourhood boundaries. The green polygons are parks. The parks are drawn over the boundaries ...
ixodid's user avatar
  • 433
9 votes
1 answer
17k views

Add Layers with Leaflet from Different Spatial Data Frames in R

Very new to R's Leaflet package and have two spatial data frames. 1) An outline of a city 2) Its major highways I wish to show both of these on the same map. I get how to do this with ggmap or ...
ixodid's user avatar
  • 433
1 vote
0 answers
496 views

Use two shapefiles in one Leaflet map in R

My query along with a minimal working example is already posted here: https://stackoverflow.com/questions/48924514/using-data-from-2-shapefiles-with-leaflet-in-r?noredirect=1#comment84855712_48924514 ...
user2338823's user avatar
2 votes
0 answers
844 views

R Shiny / leaflet map: Projection problem in creating map in Plate Carree projection

I'm trying to create an R Shiny map using the leaflet package to display input layers in the Plate Carree projection rather than the default Spherical Mercator projection. I've input OSM and WMS tile ...
Richard's user avatar
  • 39
4 votes
1 answer
2k views

Displaying sum of frequencies in leaflet cluster maps pointer

I've a dataset with locations and their frequencies (sum of counts) I want the leaflet cluster to display the frequencies as pointers instead of the count of occurrences. city state ...
Dee V's user avatar
  • 41
3 votes
1 answer
3k views

LeafletCRS projection issues

I am trying to get a map in the Dutch Rijksdriehoekstelsel coordinates in a Leaflet map in R that is going in a Shiny app later. I am going to have to add polygons later, and changing their X and Y ...
DS501's user avatar
  • 107
1 vote
1 answer
612 views

Using leaflet with large data - ACS data for all counties in U.S

I'm plotting ACS data (counts of low-income children) for each county across the entire U.S. I don't have any markers, just a county shapefile and a value for each county in a popup. Unsurprisingly ...
jzadra's user avatar
  • 157
5 votes
1 answer
20k views

Generating random lat/long coordinates

Dedicated page on use of leaflet in R provides a very useful example on generating random latitude and longitude values for Central Europe: cbind(rnorm(40) * 2 + 13, rnorm(40) + 48) which results in ...
Konrad's user avatar
  • 341
1 vote
1 answer
6k views

Cutting leaflet map in R to a specific area

I am trying to cut a leaflet map in R, so I only show a specific municipality. I have manage to hide the remaining municipalities in the country, but that leaves the water and the rest of the world ...
Tobias D's user avatar
  • 163
4 votes
1 answer
2k views

Why does Leaflet with provider tiles not draw markers as expected?

I'm working with Leaflet maps in Shiny for R. I'm producing a map with some markers on it. When I use addTiles () for my base map, everything works as expected. However with addProviderTiles (), the ...
karpfen's user avatar
  • 2,307
1 vote
0 answers
602 views

Proj4leaflet in UTM 32

I am trying to create a simple map in UTM32 (EPSG:25832) in R with leaflet and proj4leaflet, but I can't get it to work. I found a url for the basemap, but it could be a different one if you like - I ...
Tobias D's user avatar
  • 163