Created
February 27, 2019 14:57
-
-
Save fubits1/409f601173f1dac65790a897d86f1634 to your computer and use it in GitHub Desktop.
R Mapview Sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "R Notebook" | |
output: html_document | |
--- | |
```{r echo=FALSE, warning=FALSE, message=FALSE} | |
library(tidyverse) | |
library(leaflet) | |
library(mapview) | |
library(sf) | |
``` | |
```{r echo=FALSE} | |
Coords <- ggmap::geocode("Kidal, Mali", source = "dsk", output = "latlon") | |
Object_sf <- sf::st_sfc(sf::st_point(c(Coords$lon, Coords$lat)), crs = 4326) | |
``` | |
```{r echo=FALSE} | |
m1 <- leaflet() %>% | |
addTiles() %>% | |
addMarkers(Coords$lon, Coords$lat) %>% | |
setView(Coords$lon, Coords$lat, zoom = 15) | |
``` | |
```{r echo=FALSE} | |
mapparam <- c("Esri.WorldImagery") | |
m2 <- mapview(Object_sf, map.types = mapparam) | |
``` | |
```{r} | |
mapview::sync(m1,m2) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment