Skip to content

Commit

Permalink
Add map_wastd for wastd_data #60
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Mayer authored and Florian Mayer committed Jan 24, 2022
1 parent 6f274be commit 698e719
Show file tree
Hide file tree
Showing 53 changed files with 482 additions and 32 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Suggests:
covr (>= 3.5.1),
DBI (>= 1.1.1),
leaflet (>= 2.0.4.1),
leaflet.extras (>= 1.0.0),
leaftime (>= 0.2.0),
geojsonio (>= 0.9.4),
geojsonlint (>= 0.4.0),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export(map_nests)
export(map_sv_odkc)
export(map_tracks)
export(map_tracks_odkc)
export(map_wastd)
export(nest_disturbance_by_season_odkc)
export(nesting_type_by_area_season_age_species)
export(nesting_type_by_area_season_age_species_odkc)
Expand Down
11 changes: 7 additions & 4 deletions R/map_dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ map_dist <- function(dist,
# Base map
#
l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds()
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds()

# ---------------------------------------------------------------------------#
# Disturbances by cause
Expand Down Expand Up @@ -101,7 +104,7 @@ Edit record in WAStD</a></p>

l %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_dist_odkc.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ map_dist_odkc <- function(dist,
co <- if (cluster == TRUE) leaflet::markerClusterOptions() else NULL

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds()
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds()

# ---------------------------------------------------------------------------#
# Disturbances by cause
Expand Down Expand Up @@ -168,7 +171,7 @@ src="{photo_disturbance %||% ""}"></img>
}
} %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_mwi.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ map_mwi <- function(data,
url <- sub("/$", "", wastd_url)

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds()
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds()


if (!is.null(data) && nrow(data) > 0) {
Expand Down Expand Up @@ -107,7 +110,7 @@ href="{url}{absolute_admin_url}">Edit on WAStD</a></p>
}
} %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_mwi_odkc.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ map_mwi_odkc <- function(data,
overlay_names <- c()

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds()
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds()


if (!is.null(data) && nrow(data) > 0) {
Expand Down Expand Up @@ -136,7 +139,7 @@ Samples taken: {checks_samples_taken}<br/>
}
} %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_nests.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ map_nests <- function(data,
url <- sub("/$", "", wastd_url)

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds() %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds() %>%
leaflet::addAwesomeMarkers(
data = data,
lng = ~encounter_longitude,
Expand Down Expand Up @@ -73,7 +76,7 @@ href="{url}{encounter_absolute_admin_url}">Edit on WAStD</a></p>
clusterOptions = co
) %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = c("Nests"),
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_sitevisit.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ map_sv_odkc <- function(svs,
co <- if (cluster == TRUE) leaflet::markerClusterOptions() else NULL

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds() %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds() %>%
# Site Visit Start
leaflet::addAwesomeMarkers(
data = svs,
Expand Down Expand Up @@ -109,7 +112,7 @@ map_sv_odkc <- function(svs,
label = ~site_name
) %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = c("Site Visit Start", "Site Visit End"),
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_tracks.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ map_tracks <- function(tracks,
if (!("name" %in% names(tracks))) tracks <- dplyr::mutate(tracks, name = "")

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds(.) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds() %>%
{
if (ts == TRUE) {
leaftime::addTimeline(.,
Expand Down Expand Up @@ -123,7 +126,7 @@ href="{url}{absolute_admin_url}">Edit on WAStD</a></p>
}
} %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
11 changes: 7 additions & 4 deletions R/map_tracks_odkc.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ map_tracks_odkc <- function(tracks,
}

l <- leaflet::leaflet(width = 800, height = 600) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Aerial") %>%
leaflet::addProviderTiles("OpenStreetMap.Mapnik", group = "Place names") %>%
leaflet::clearBounds(.) %>%
leaflet::addProviderTiles("Esri.WorldImagery", group = "Basemap") %>%
leaflet::addProviderTiles(
"OpenStreetMap.Mapnik", group = "Basemap",
options = leaflet::providerTileOptions(opacity = 0.35)) %>%
leaflet.extras::addFullscreenControl(pseudoFullscreen = TRUE) %>%
leaflet::clearBounds() %>%
{
if (ts == TRUE) {
leaftime::addTimeline(
Expand Down Expand Up @@ -133,7 +136,7 @@ map_tracks_odkc <- function(tracks,
}
} %>%
leaflet::addLayersControl(
baseGroups = c("Aerial", "Place names"),
baseGroups = c("Basemap"),
overlayGroups = overlay_names,
options = leaflet::layersControlOptions(collapsed = FALSE)
)
Expand Down
Loading

0 comments on commit 698e719

Please sign in to comment.