9
votes
Accepted
R leaflet set zoom level of tiled basemap (ESRI World Imagery)
If you set maxZoom and maxNativeZoom you can get past this - for example:
addProviderTiles('Esri.WorldImagery',
options = providerTileOptions(maxNativeZoom=19,maxZoom=100)) %>%
then from zoom ...
9
votes
Accepted
Order of Vector Layers in Leaflet-R
This is possible with the latest leaflet version from github. They've introduced a function called addMapPane which gives full control over individual layer ordering. Here's an example:
# devtools::...
9
votes
Accepted
Add Layers with Leaflet from Different Spatial Data Frames in R
simply, dont add the dataset in the leaflet() function:
leaflet() %>% addProviderTiles("CartoDB.Positron") %>%
addPolygons(data=tonto, fillOpacity = 0.7,weight = 1.2, etc....)%>%
...
6
votes
Accepted
Generating random lat/long coordinates
What you want to do is to generate a random set of numbers within the following approximated box:
[Longitude, Latitude]
[-10.8544921875, 49.82380908513249],
[-10.8544921875, 59.478568831926395],
...
5
votes
R leaflet - Bring base layer labels to front
Using the latest leaflet version (2.0.1) allows to create custom map panes in order to control layer ordering. In combination with tile providers that serve base layers without labels and base layers ...
5
votes
Accepted
Shiny leaflet click-event returns NULL when clicked again
The problem is caused because you are drawing a new version of the selected polygon when the click event happens. Then, when you think you are clicking on the original polygon for the second time you'...
3
votes
Accepted
Displaying several data rows in popup using Leaflet for R?
First, I think it's a conceptual problem because you have repeated points with different data in the same location, e.g .: Angelsberg and Asselborn locations. So the popup from addMinicharts function ...
3
votes
Accepted
Conditionally adding markers to map in R leaflet and shiny
Are you trying to put if statements into a magritrr piping chain? A little experiment will show this does not work:
> z = 1
> 2 %>% sqrt() %>% if(z==1){log()} %>% if(z==2){sqrt()} %>...
3
votes
Accepted
LeafletCRS projection issues
First of all, the map is gray because you mixed up the coordinates. Just change the view from setView(52,5.1,13) to setView(5.1,52,13) and the map should render. It will be wrong though.
You had a ...
2
votes
Displaying sum of frequencies in leaflet cluster maps pointer
One possible answer is expand your data.frame by the column Count. Doing this, you will have n number of points (based on Count) for every location.
Try the reproducible example below:
# Load ...
2
votes
Identifying grid number by lat, long
As I understand it, you are requesting two separate issues:
how to associate each point with the ID of the tile it falls in
how to count/perform stats on the points contained in each tile
Associate ...
2
votes
Rearrange plotorder of SpatialPolygonsDataframe
You can set the plotting order of a SpatialPolygonsDataFrame by assigning to the plotOrder slot.
You can use area to get the area of each row of a SpatialPolygonsDataFrame.
You can use order to get ...
2
votes
Accepted
Can't add WMS layer to R Leaflet
It seems that the problem is due to the name of the layer. Replace that by the ordinal number, and your script will work:
leaflet() %>%
setView(lng = -1.8, lat = 53.6, zoom = 10) %>%
...
2
votes
Accepted
How to read a dataframe and show it on leaflet
You are only missing one step. What you have is a standard data frame, which Leaflet cannot interpret as a spatial object.
You first need to convert your df to a spatial object: the sf package is ...
2
votes
R - not the same number of raster cells after reprojection
I think I found the problem: for some reason, the projectRaster command introduces a "frame" of additional, empty (NA) cells around the original data.
As discussed in the comments above, there are ...
2
votes
Accepted
Why does Leaflet with provider tiles not draw markers as expected?
Using the RStudio IDE, your code worked fine in the Viewer Pane. However, it didn't worked using Firefox 52.0.1 browser.
Commenting the observer() function and adding addAwesomeMarkers () to the ...
1
vote
Accepted
Append more variables to a SpatialPolygonsDataFrame using R
Pretty close! You need to make use of sp::merge() instead of merge from base R in order to get a SpatialPolygonsDataFrame instead of a data frame without geometry information.
library(raster)
library(...
1
vote
Accepted
Cannot plot OSM data retrieved from R package 'osmdata' with leaflet directly
On the osmdata GitHub issues I found that the problem relates to the simple features having an assigned "name", which is the row name.
Here is the issue, and what it shows is that if you add this ...
1
vote
Standard for publication-ready R-based geographic images?
It is possible to use basemaps in the non-interactive mode of the tmap package.
However, it requires two steps:
Downloading/preparing raster data with three layers (RGB)
Start making the map with ...
1
vote
Accepted
How to create independent/fixed inset maps with leaflet?
You need to set centerFixed and zoomLevelFixed:
centerFixed
Applies a fixed position to the minimap regardless of the main map's view / position. Prevents panning the minimap, but does allow ...
1
vote
Highlight Borders When Mouseover Fill Area - Leaflet-R
I think if you add weight argument to your highlightOptions(), the border width should change on hover. For example:
addPolygons(
...
highlightOptions = highlightOptions(stroke = 4, weight = ...
1
vote
Accepted
Using leaflet with large data - ACS data for all counties in U.S
The solution is found in r package rmapshaper.
Apply the function rmapshaper::ms_simplify() to the result of tigris::geo_join() (the merged Large SpatialPolygonsDataFrame that is the combination of ...
1
vote
Accepted
Cutting leaflet map in R to a specific area
I would possibly proceed as follows:
first, create a worldwide raster using the default spatial extent of the 'missing' method (see ?raster: xmn=-180, xmx=180, ymn=-90, ymx=90);
then, transform ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
leaflet-r × 43r × 33
leaflet × 17
shiny × 9
coordinate-system × 3
mapview × 3
qgis × 2
raster × 2
sf × 2
sp × 2
polygon × 1
openstreetmap × 1
wms × 1
geotiff-tiff × 1
line × 1
coordinates × 1
mapbox × 1
markers × 1
utm × 1
census × 1
land-cover × 1
polyline-creation × 1
united-kingdom × 1
gdal2tiles × 1
random × 1