Skip to content

Instantly share code, notes, and snippets.

🛰️

J. Schwalb-Willmann 16EAGLE

🛰️
View GitHub Profile
@16EAGLE
16EAGLE / moveVis_add_custom_map_service.R
Created Apr 3, 2020
Short example on how to add additional tile API URLs for downloading base maps
View moveVis_add_custom_map_service.R
library(moveVis)
# example data
data("move_data")
m <- align_move(m = move_data, res = 4, unit = "mins")
# add new service to moveVis, e.g. an ESRI layer
services <- getOption("moveVis.map_api")
services$esri <- list(hillshade = "https://services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade_Dark/MapServer/tile/")
options(moveVis.map_api = services)
@16EAGLE
16EAGLE / moveVis_colours_by_variable.R
Last active May 7, 2019
Short moveVis example on how to colour paths based on a continuous variable
View moveVis_colours_by_variable.R
# use moveVis >= 0.10.2 for this example
library(moveVis)
library(move)
library(plyr)
# get example data. align movement to unique times and regular resolution
data("move_data")
m.aligned <- align_move(move_data, res = 4, unit = "mins")
# let's create some fake continous variable by splitting the moveStack into single tracks
@16EAGLE
16EAGLE / moveVis_hold_last_frame.R
Created Apr 25, 2019
Short moveVis example on how to hold the last frame of an animation for a defined time and make it look good by using path_fade
View moveVis_hold_last_frame.R
# use moveVis >= 0.10.2 for this example (does not work with CRAN version 0.10.1)
# remotes::install_github("16eagle/moveVis")
library(moveVis)
library(move)
data("move_data")
# align movement to unique times and regular resolution
m <- align_move(m = move_data, digit = 0, res = 4, unit = "mins")
@16EAGLE
16EAGLE / moveVis_show_traces.R
Last active Mar 18, 2020
Short moveVis example on how to display the full traces of each path using trace_show and trace_colour with frames_spatial()
View moveVis_show_traces.R
# use moveVis >= 0.10.2 for this example (does not work with CRAN version 0.10.1)
# remotes::install_github("16eagle/moveVis")
library(magrittr)
library(move)
library(moveVis)
data("move_data")
m <- align_move(move_data, res = 4, unit = "mins")
@16EAGLE
16EAGLE / moveVis_colours_by_change_points.R
Last active Nov 30, 2019
Short moveVis example on how to assign multiple path colours per individual to indicate e.g. behavioral segments
View moveVis_colours_by_change_points.R
# use moveVis >= 0.10.1 for this example
library(moveVis)
library(move)
data("move_data")
# align movement to unique times and regular resolution
m.aligned <- align_move(move_data, res = 4, unit = "mins")
m.split <- split(m.aligned)
@16EAGLE
16EAGLE / moveVis_overlay_base_map_with_transparent_rasters.R
Created Mar 7, 2019
Short moveVis example on how to overlay frames with additional transparent rasters changing over time
View moveVis_overlay_base_map_with_transparent_rasters.R
library(moveVis)
library(move)
library(ggplot2)
data("move_data", "basemap_data")
m <- align_move(move_data, res = 4, unit = "mins")
## create frames using mapbox base map
frames <- frames_spatial(m, map_type = "satellite", map_service = "mapbox", map_token = "YOUR_VERY_LONG_TOKEN",
path_legend = T)
@16EAGLE
16EAGLE / moveVis_get_coordinates_per_frame.R
Created Mar 7, 2019
Short moveVis example on how to create a data.frame containing each track coordinate per frame
View moveVis_get_coordinates_per_frame.R
# this example uses internal functions since there are no user functions yet to do this
library(moveVis)
data("move_data")
m <- align_move(move_data, res = 4, unit = "mins")
# m must be aligned, check (returns an error, if m is not aligned, does nothing, if m is aligned)
moveVis:::.time_conform(m)
# if you are certain, m is the same variable you used with frames_spatial, you can remove line 9
@16EAGLE
16EAGLE / moveVis_adapt_legend.R
Last active Mar 7, 2019
Short moveVis example on how to adapt the path legend of frames created with frames_spatial()
View moveVis_adapt_legend.R
library(moveVis)
library(move)
library(ggplot2)
data("move_data")
# align movement to unique times and regular resolution
m <- align_move(move_data, res = 4, unit = "mins")
# some path colours by individual
m.list <- split(m) # split m into list by individual
You can’t perform that action at this time.