Description Usage Arguments Value Author(s) Examples
This function visualizes STPs in 3D. It can be used to plot multiple STP_Tracks in interactive 3D plot.
1 2 |
STP_track |
A STP_Track . |
time_interval |
the time interval in minutes.Determines the amount of PPAs that are plotted. |
zfactor |
realtive size of z axis compared to x and y axis. default=NULL: ratio axes depns on input data |
col |
colour of STP(s). |
st |
start time as "POSIXct" or"POSIXt". For plotting multiple STP_tracks use 1 starttime. |
alpha |
transparency of STPs. between 0 and 1 |
cut_prisms |
In case of time uncerainty: wheter to cut the middle and normally overlapping prisms at the original time of the space-time points. Only relevant if alpha<1. default is TRUE |
quadsegs |
Passed to PPA method. Number of line segments used to approximate a quarter circle. |
If no zfactor is provided, method returns calculated zfactor. Otherwise mehtod returns NULL
Mark ten Vregelaar
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 | library(spacetime)
library(sp)
library(rgl)
## create 2 STP_tracks
# time
t1 <- strptime("01/01/2017 00:00:00", "%m/%d/%Y %H:%M:%S")
t2 <- t1+5*60*60 # 5 hours after t1
time1<-seq(t1,t2,30*60)
time2<-time1+0.25*60*60
# spatial coordinates
x1=c(seq(0,25,5),seq(27.5,37.5,2.5))
y1=sample(-2:2, 11,replace = TRUE)
x2=x1+7
y2=sample(-2:2, 11,replace = TRUE)
n = length(x1)
crs_NL = CRS("+init=epsg:28992")
# create class STIDF
stidf1 = STIDF(SpatialPoints(cbind(x1,y1),crs_NL), time1, data.frame(co2 = rnorm(n),O2=rnorm(n)))
stidf2 = STIDF(SpatialPoints(cbind(x2,y2),crs_NL), time2, data.frame(co2 = rnorm(n),O2=rnorm(n)))
# Track-class {trajectories}
my_track1<-Track(stidf1)
my_track2<-Track(stidf2)
# set maximum speed
v1<-getVmaxtrack(my_track1)*2
v2<-getVmaxtrack(my_track2)*1.5
# STP_track class
STP_track1<-STP_Track(my_track1,v1)
STP_track2<-STP_Track(my_track2,v2)
open3d()
## 3D STP plot of STP_tracks
z_fac<-0.2 # relative size of z scale/aspect ratio to spatial scale
# plot STPS first STP_track
zf<-STP_plot(STP_track1,time_interval = 1)
# plot STPS second STP_track
STP_plot(STP_track2,time_interval = 1,zf,'blue',st = STP_track1@endTime[1])
# provide st for correct starting location first STP
# calculate first and last moment in time
min_max_Time<-c(STP_track1@endTime[1],STP_track2@endTime[length(STP_track2)])
# add axes
axes_STP_plot(min_max_Time,z_factor = zf)
# add title and change background colour
title3d(main = '2 STP tracks')
bg3d('lightblue')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.