-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.r
28 lines (21 loc) · 846 Bytes
/
map.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(tidyverse)
library(ggmap)
library(sf)
library(mapview)
library(leaflet)
library(wesanderson)
mapviewOptions(basemaps = "Esri.WorldShadedRelief",
raster.palette = grey.colors,
vector.palette = colorRampPalette(colors = c("#000000","#C93312","#046C9A","#D69C4E","#ABDDDE")),
na.color = "magenta",
layers.control.pos = "topright")
locations_df <- read.csv("df.csv", header= TRUE, row.names = 1)
locations_df
locations <- as_tibble(locations_df)
Populations <- st_as_sf(locations, coords = c("lon", "lat"), crs = 4326)
m = mapview(Populations, zcol = "Source", legend = TRUE)
m
## create .html and .png
mapshot(m, url = paste0(getwd(), "/map.html"))
mapshot(m, file = paste0(getwd(), "/Geo_map.pdf"),
remove_controls = c("homeButton", "layersControl", "zoomControl"))