leaflet_geopos: reads and plots geolocation estimates derived from archival...

View source: R/leaflet_geopos.r

leaflet_geoposR Documentation

reads and plots geolocation estimates derived from archival tagging data

Description

This function creates a Leaflet map widget using htmlwidgets from spatial tagging data. The widget can be rendered on HTML pages generated from R Markdown, Shiny, or other applications.

Usage

leaflet_geopos(data, ID_label, add_label=NULL, except_label=NULL, 
               collapsedLayers=TRUE, radius=1000, pal,
               layer_title=ID_label, colorby="date", cb.title, cbpos="bottomright",
               showScaleBar=TRUE, showSlideBar=FALSE)

Arguments

data

spatial data such as data.frame or SpatialPolygonsDataFrame.

ID_label

Vector in spatial data that defines the ID of the tracks to be plotted.

add_label, except_label

additional labels or labels to be removed from hover.

collapsedLayers

whether to collapse leaflet layer legend.

radius

circle size, in case of simple Lon/Lat tracking dataframes.

pal

color map to be plotted in case of polygon (.nc-files) or scatter plots (default is the 'jet'-colormap, and 'year.jet' in case standard_year & full_year are set TRUE). See cmap for pre-installed color maps. Note that tracking data with constant time steps is being assumed in the color assignment. To verify this, a data.frame containing the colors at each time steps will be returned for polygon and scatter plots.

layer_title

character string indicating the title of the layer legend (by default defined by 'ID_label'.)

colorby

character string indicating the vector for which to apply the colorbar (by default 'date'.)

cb.title

character string indicating the title of the colorbar (by default inferred from colorby),

cbpos

position of the colorbar (by default 'bottomright'.)

showScaleBar, showSlideBar

whether to show the scale bar or the slide bar.

Author(s)

Robert K. Bauer

See Also

ggplotly_geopos, ggplot_geopos, update_leaflet_elementId

Examples


# csv_file <- system.file("example_files/15P1019-104659-1-GPE3.csv",package="RchivalTag")
# s0 <- get_geopos(csv_file)
# ggplot_geopos(s0)
# leaflet_geopos(s0,ID_label="DeployID")
# leaflet_geopos(s0,ID_label="DeployID",showSlideBar = T)
#
# kmz_file <- system.file("example_files/15P1019-104659-1-GPE3.kmz",package="RchivalTag")
# k1 <- get_geopos(kmz_file)
# kmz_file2 <- system.file("example_files/15P0986-15P0986-2-GPE3.kmz",package="RchivalTag")
# k2 <- get_geopos(kmz_file2)
# k0 <- k3 <- rbind(k1,k2)
# ggplot_geopos(k0,ggobj = ggplotmap("lion"))
# 
# # ggobj <- ggplot_geopos(k1)
# # ggplot_geopos(ggobj = ggobj,k2)
# leaflet_geopos(k0,ID_label="DeployID",collapsedLayers = F) %>% addMiniMap()
# leaflet_geopos(k0,ID_label="DeployID",showSlideBar = T)
#
## Code to illustrate how to avoid rendering issues in RMarkdown:
## only valid in RMarkdown chunks:
# kmz_file2 <- system.file("example_files/15P0986-15P0986-2-GPE3.kmz",package="RchivalTag")
# k2 <- get_geopos(kmz_file2)
# k0 <- k3 <- rbind(k1,k2)
#
# library(leaflet)
# map <- leaflet_geopos(k0, ID_label="DeployID", collapsedLayers = F)
# map
# map # plot again to show rendering issues (in the layer menu title)
## this is required to avoid rendering issues when plotting the same map twice via RMarkdown 
# map <- update_leaflet_elementId(map) 
#
# plot again with updated elementID:
# map %>% addMiniMap()

RchivalTag documentation built on Nov. 10, 2023, 5:06 p.m.