-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
98 lines (98 loc) · 4.07 KB
/
.Rhistory
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
### FINDING BACKGROUNDS TO WORK WITH
getwd()
library(leaflet)
popup = c("Robin", "Jakub", "Jannes")
leaflet() %>%
addProviderTiles("Esri.WorldPhysical") %>%
addProviderTiles("Esri.WorldImagery") %>%
addAwesomeMarkers(lng = c(-3, 23, 11),
lat = c(52, 53, 49),
popup = popup)
leaflet() %>%
addTiles() %>%
addProviderTiles("Esri.WorldImagery",
options = providerTileOptions(opacity=0.5)) %>%
setView(lng = 151.005006, lat = -33.9767231, zoom = 10)
leaflet() %>%
addTiles() %>%
setView( lng = 2.34, lat = 48.85, zoom = 5 ) %>%
addProviderTiles("Esri.WorldPhysical", group = "Physical") %>%
addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
addProviderTiles("MtbMap", group = "Geo") %>%
# addProviderTiles("NASAGIBS.ViirsEarthAtNight2012") # does not work
# addProviderTiles("NASAGIBS.ModisTerraTrueColorCR") # does not work
# options = providerTileOptions(time = "2015-08-31", opacity = 0.5))
addLayersControl(
baseGroups = c("Geo","Aerial", "Physical"),
options = layersControlOptions(collapsed = T))
getwd()
### ELENOVO burial mounds: prepare data
# Read data from where you downloaded it. Adela,look in: D:/Adela/Professional/Projects/MQNS/Data/"
mounds <- read.csv("data/ElenovoMounds_cleaned.csv", stringsAsFactors = FALSE)
cols.num<- c("Longitude","Latitude", "Northing", "Easting")
mounds[cols.num]<-sapply(mounds[cols.num], as.numeric) # some NA's wh
# Eliminate any detected NAs
which(is.na(cols.num))
mounds[25,] #row 25 in original dataset has multivalued coordinate, which is coerced into NA
mounds <- st_as_sf(mounds, coords = c("Longitude", "Latitude"), crs = 4326)
suppressMessages({
library(tidyverse)
library(sf)
library(htmltab)
})
# Transform dataframe into a spatial feature and project to Web Mercator
# Leaflet basemapes here are 3D
mounds <- st_as_sf(mounds, coords = c("Longitude", "Latitude"), crs = 4326)
st_crs(mounds)
plot(mounds$geometry, pch = 2, cex = sqrt(mounds$HeightMax))
library(leaflet)
leaflet() %>%
addTiles() %>%
addProviderTiles("Esri.WorldTopoMap", group = "Topo") %>%
addProviderTiles("Esri.WorldImagery", group = "ESRI Aerial") %>%
# addMarkers(data=mounds, group="Mounds", icon = MoundIcon,
addCircleMarkers(data=mounds, radius = mounds$HeightMax*1.5, opacity = 0.5, color= "black", stroke = TRUE,
fillOpacity = 0.5, weight=2, fillColor = "yellow",
popup = paste0("MoundID: ", mounds$identifier,
"<br> Height: ", mounds$HeightMax,
"<br> Condition: ", mounds$Condition,
"<br> Last Damage: ", mounds$MostRecentDamageWithin)) %>%
addLayersControl(
baseGroups = c("Topo","ESRI Aerial"),
overlayGroups = c("Mounds"),
options = layersControlOptions(collapsed = T))
# Make pretty mound icon
MoundIcon <- makeIcon(
iconUrl = "data/Mound.png", 20, 20)
leaflet() %>%
addTiles() %>%
addProviderTiles("Esri.WorldTopoMap", group = "Topo") %>%
addProviderTiles("Esri.WorldImagery", group = "ESRI Aerial") %>%
addMarkers(data=mounds, group="Mounds", icon = MoundIcon,
# addCircleMarkers(data=mounds, radius = mounds$HeightMax*1.5, opacity = 0.5, color= "black", stroke = TRUE,
# fillOpacity = 0.5, weight=2, fillColor = "yellow",
popup = paste0("MoundID: ", mounds$identifier,
"<br> Height: ", mounds$HeightMax,
"<br> Condition: ", mounds$Condition,
"<br> Last Damage: ", mounds$MostRecentDamageWithin)) %>%
addLayersControl(
baseGroups = c("Topo","ESRI Aerial"),
overlayGroups = c("Mounds"),
options = layersControlOptions(collapsed = T))
MoundIcon <- makeIcon(
iconUrl = "data/Mound.png", 20, 20)
leaflet() %>%
addTiles() %>%
addProviderTiles("Esri.WorldTopoMap", group = "Topo") %>%
addProviderTiles("Esri.WorldImagery", group = "ESRI Aerial") %>%
addMarkers(data=mounds, group="Mounds", icon = MoundIcon,
# addCircleMarkers(data=mounds, radius = mounds$HeightMax*1.5, opacity = 0.5, color= "black", stroke = TRUE,
# fillOpacity = 0.5, weight=2, fillColor = "yellow",
popup = paste0("MoundID: ", mounds$identifier,
"<br> Height: ", mounds$HeightMax,
"<br> Condition: ", mounds$Condition,
"<br> Last Damage: ", mounds$MostRecentDamageWithin)) %>%
addLayersControl(
baseGroups = c("Topo","ESRI Aerial"),
overlayGroups = c("Mounds"),
options = layersControlOptions(collapsed = T))