PySTPrism: Tools for Voxel-based Space–Time Prisms PySTPrism: Tools for Voxel-based Space–Time Prisms

The observed movements of humans and animals are realizations of complex spatiotemporal processes. Recent advances in location-aware technologies have rendered trajectory data ubiquitous. Examining the sequenced, instantaneous locations found in movement trajectory data for information reconstructing the location or state of the mover between observed points comprises a primary focus in Time Geography and related disciplines. The PySTPrism toolbox introduced in this paper provides a straightforward and open-source implementation of the Probabilistic Space Time Prism, in addition to related tools from Time Geography. PySTPrism is implemented in Python using the ArcPy module in ArcGIS Pro Desktop.


Motivation and significance
The observed movements of humans and animals are realizations of complex spatiotemporal processes [1,2]. Movement captured as sequences of time-stamped locations, termed trajectory datasets, may be conceptualized as a complex signal reflecting the decisions, context, and internal states affecting the mover [3,4]. With recent advances in location-aware technologies, trajectory data has become ubiquitous. Examining the sequenced, instantaneous locations found in movement trajectory data for information reconstructing the location or state of the mover between observed points comprises a primary focus in Time Geography and related disciplines [5,6]. Here, time-geographic questions concerning accessibility, utilization of space, and spatiotemporal interactions among movers and the environment have been proven relevant to biological, ecological, and sociological inquiries, as well as conservation and planning studies, and to some extent virtual reality and cybernetics. In these studies, trajectory data have been analyzed from a time-geographic perspective towards clearer understandings of animal interactions [7], habitat use [8,9], planning for conservation efforts [10][11][12] and human accessibility to transit systems [13] or spatiotemporal positioning across networks [14,15] and positioning in virtual environments [16]. Part of Hägerstrand's original framework for time geography as a discipline [17], the Space-Time Prism approach and its derivatives represent a common methodological factor among many of the studies mentioned here, in efforts to quantify the constrained and uneven movement opportunities available to humans and animals traversing through space. Alternatively, a range of methods analyze trajectory data without specific application of the Space-Time Prism, instead examining and summarizing the parameters of trajectories towards insight about the moving objects that produced them. Examples include temporally-aware variants of kernel density estimators [18], methods which decompose trajectories into symbolic sequences [19], methods which characterize trajectories in terms of their tortuosity [20], compare observed trajectories to those simulated in random walks [21], and compare observed trajectories to one another for similarity [22,23]. Additionally, trajectories may be analyzed for clusters [24], and the examination of single moving objects within a larger group [25]. While all of these alternatives consume movement data as input, their focus is not immediately on the bounding and evaluation of movement opportunity in space.
The Space-Time Prism (STP) is a constraints-based approach used to delineate and characterize the movement opportunities available to a moving object in terms of space, time and velocity [26,27]. Given information describing observed starting and ending spatiotemporal point locations for a moving object (also known as space-time anchors), the time elapsed between anchors, and an estimate of the moving object's maximum attainable speed, the classical STP calculation constructs a bounding volume capturing the set of possible locations the object would have been feasibly able to visit over the course of its travel along its spacetime path between anchors. Essentially, a particular location is included in the prism if it could have been visited by the object traveling between anchors, given a movement budget defined in terms of speed and available time (Fig. 1). The set of locations accessible to an object at a particular instance in time is termed a space-time disk. Infinitely many disks may comprise a spacetime prism, and taken individually, disks exhibit their greatest area at the midpoint between anchors, and converge to zero area at the anchors (where object position is relatively certain). Eq. (1) describes the classical STP calculation applied to voxels. Voxels (volume-elements) are discretized positions in both space (X and Y) and time (Z), having a fixed spatial and temporal resolution [8,28]. From a computing perspective, voxels offer an effective simplification of the concepts and calculations involved in constructing the space-time prism easily represented as raster data. where: ∥x x − x x ∥ is a Euclidean distance calculation between the current voxel centroid location x a and either the starting x i , or ending x j , space-time anchor locations in a given anchor pair. t a is the temporal midpoint associated with x a , and (t a − t i ) s ij , ( t a − t j ) s ij expressions calculate the distance the object could have successfully traversed between the anchors, given the time elapsed and remaining between x i and x j , respectively, considering the object's expected maximum speed, s ij .
The classical STP is of course limited in that accessibility is defined as a binary condition. The literature recognizes movement opportunities to be uneven within the STP volumes, with influences such as context, behavior, and anchor positional uncertainty contributing to this variation [1,8,29]. Extensions to the classical STP abound in the literature as a response to this limitation, including methods which apply random walks [30], Brownian bridges [31], kinematic constraints [32], awareness of inhomogeneous mover context [29,33], spatial interpolations functions [8] and hybrid methods such as behavioral-contextual agent-based simulation [1].
PySTPrism is a GIS toolbox for generating and generalizing space-time prisms for moving objects, and forms the impetus for this document as its introduction. The toolbox contains 4 tools, including tools generating two respective space-time prism variants, a means to combine prism results at the disk level, and a trajectory data pre-processing tool. The prism generation and generalization implementations released with this PySTPrism toolbox were used directly to generate probabilistic space-time prism and probability surface results as-presented in a range of peer-reviewed studies concerning animal movement, interaction, habitat use and conservation planning [7][8][9]11,12]. As a result of conversations with colleagues from disciplines outside computational movement analysis, the Authors resolved to package and release this implementation as the PySTPrism toolbox. The wide applicability of Hägerstrand's initial construction, and Downs' straightforward probabilistic extension of the space-time prism concept are still being realized in efforts far removed from the initial research questions treated by these methods. PyST-Prism promotes the analysis of movement across disciplines by rendering foundational methodologies more accessible to all researchers. In the following sections, the methods operationalized in PySTPrism are described and demonstrated using an abstract sample trajectory tracking an imagined moving object over a 200second duration, having space-time anchor captures at 100 s intervals, each of which represent locations 100 m apart in an appropriate coordinate space.

Software description
As an open-source extension to the popular ESRI ArcGIS Pro desktop application, PySTPrism seeks to provide researchers from a range of disciplines with a simple means to construct spacetime prisms for their respective research targets.

Software architecture
Four tools are contained in the PySTPrism toolbox. These include the space-time prism generators Generate Probabilistic Voxel Space-Time Prism and Generate Voxel Space-Time Prism, along with a probabilistic aggregation function for space-time disks, Calculate Probability Surface, and a data pre-processing tool, Save Pre-Processed Trajectory. The toolbox is implemented in Python 3.x, relying on the ArcPy module, a general application programming interface exposing functionality inherent to ArcGIS Pro. Additionally, some functionality in the PySTPrism toolbox leverages operations requiring an Advanced license level for Ar-cGIS Pro, as well as licensure for the Spatial Analyst extension. The tools can be accessed interactively through their respective geoprocessing tool GUIs in ArcGIS Pro, or programmatically as python objects within or outside of an ArcGIS Pro session. The tools packaged with PySTPrism accept input trajectory data as vector point feature classes subscribing to a projected coordinate system, and expect each point to carry a corresponding timestamp attribute value held in a DATE type field. PySTPrism returns raster datasets representing space-time disks as the interchange format for results.

Software functionalities 2.2.1. Generate Probabilistic Voxel Space-Time Prism
The Generate Probabilistic Voxel Space-Time Prism tool is discussed first in this document as it is the main tool implemented in the PySTPrism toolbox. Generate Probabilistic Voxel Space-Time Prism operationalizes the voxel based probabilistic space-time prism (PSTP) approach introduced in Downs, (2014) [8]. The PSTP approach exposed in PySTPrism serves as a reference implementation for Downs' PSTP and has been directly employed in its current and earlier iterations to several studies concerning animal movement and interaction in space and time [7][8][9]11,12].
Generate Probabilistic Voxel Space-Time Prism accepts a reference (path-to-data) to a point feature class representing the observed space-time anchors from a moving object trajectory and the name of the field recording anchor timestamps. The tool returns a file geodatabase at the User's choice of location containing a series of raster datasets each representing a probabilistic voxel space-time disk comprising the prism, where each disk's Z -axis height is synonymous with the duration of time it represents. In short, Generate Probabilistic Voxel Space-Time Prism extends the operation shown in Eq. (1) to include application of a distancedecay function assigning visit probabilities, P ( STP xa ) , to voxel locations (Eq. (2)).
where: ∥x x − x x ∥ is a Euclidean distance calculation between the current voxel centroid location x a and the intersection point x s of its host space-time disk k, and the space-time path.
Additional parameters accepted by Generate Probabilistic Voxel Space-Time Prism include: the desired interval of time (Z, in seconds) each prism disk raster is meant to represent, the cellular (X/Y) resolution for the disks (in map units, inherited from the input trajectory's projected coordinate system), the velocity multiplier, a factor capturing the notion that an observed moving object may not have been moving at its top speed while tracked, and expand edges, a multiplier that expands the analysis extent for raster outputs, avoiding situations where disk values are truncated at the edge of the analysis extent. Care should be exercised while selecting disk temporal interval, disk cell size, velocity multiplier and expand edges factor. Trade-offs between temporal and spatial resolution should be considered as overall computational effort constructing the prism is sensitive to these parameter decisions. Users should consider the overall scale of the observed movement trajectory and the scale of the relationship or phenomena they are exploring as expressed by the trajectory in selecting these parameters. Values for velocity multiplier should be set with consideration of known movement characteristics of the subject. For example, the trajectory observed for a duck meandering through an urban greenspace setting is not generally indicative of the animal's top speed. Increasing the velocity multiplier in this situation would help capture the capability of the animal. Finally, computational effort is sensitive also to the expand edges parameter, as this parameter effectively multiplies the amount of disk cells undergoing PSTP calculation.

Generate Voxel Space-Time Prism
The Generate Voxel Space-Time Prism (VSTP) tool provides an implementation of Hägerstrand's [17] classical STP (Section 1), discretized on the basis of voxels per the early work of Huisman and Forer [28]. VSTP represents the foundational logic and approach from which PSTP was developed, and is included in PySTPrism as both a reference implementation for the classical STP and a tool applicable in situations where a binary measure accessibility is the target (for example, in the simple alibi query). The interface exposed in PySTPrism is identical for the VSTP and PSTP tools, and both are parameterized identically. The main difference between VSTP and PSTP is the addition of a distancedecay approach in PSTP, assigning a visitation probability to each voxel. The VSTP relates spatiotemporal accessibility in terms of a binary 1/0 result assigned to voxels comprising raster space-time disks.

Calculate Probability Surface
The Calculate Probability Surface (CPS) tool performs the probabilistic OR operation Eq. (3) across an arbitrary number of input space-time disks. Given a sequence of inputs, the base calculation involves obtaining the OR result from the first (A) and second (B) raster space-time disks in the series, with the result applied recursively as (A) in the subsequent calculation, and so on until the sequence is exhausted. CPS represents a means to aggregate the information held in either binary (VSTP) or probabilistic (PSTP) space time disks either serially (in sequence, with disks taken from a single prism), or laterally (among disks representing the same timeframe, taken from separate prisms). The CPS calculation is carried out on the basis of voxel centroid locations. The CPS approach has been integral to several studies, including those exploring animal interaction with the built environment [12], and conservation planning studies seeking to place animal crossing structures optimally [11]. In these studies, aggregate understandings of larger-scale movement processes (as captured by CPS) were compared with contextual factors in the study area towards answering conservation and planning questions.
The CPS tool accepts a list of raster datasets (space-time disks) as input, and returns a single raster reflecting the CPS result. The CPS result is saved to the User's choice of geodatabase container per the value entered in the Output Geodatabase and Output Probability Surface Raster parameters of the tool. Users should ensure that input space-time disks share a consistent spatial and temporal resolution (voxel X /Y /Z dimensions). At this time, CPS provides no validation or check asserting that input spacetime disks share the same spatial and temporal resolution, etc. Comparison of mismatched disks in terms of resolution, or disks which are out-of-sequence in lateral disk aggregations can render results difficult to interpret or meaningless overall.

Save pre-processed trajectory
The Save Pre-Processed Trajectory tool is a pre-processing tool for point feature classes representing trajectory data. The operations encapsulated in the Save Pre-Processed trajectory tool happen automatically as part of the VSTP and PSTP routines, however this tool allows users to examine the movement parameters of the input prior to calculating prisms. The Save Pre-Processed trajectory tool performs calculations adding fields recording the offset distance (in map units), time elapsed (in seconds) and velocity (in map units per second) observed between fix locations present in the feature class supplied as the Input Point Features argument. The pre-processed result is saved as a separate copy of the Input Point Features at the User's choice of file geodatabase location. This tool is meant as an assist for initial exploration of the movement characteristics captured in a timestamped point pattern. Movement characteristics (distance, time elapsed, velocity) calculated between any two sequential trajectory fix locations A and B are written to fields associated with fix A. The final point location in the trajectory will reflect 0 for movement characteristics values.

Illustrative examples
The following demonstrates use of the Generate Probabilistic Voxel Space-Time Prism from the toolbox GUI interface and examines the result in terms of the PSTP methodology. In the following demonstration, an abstract sample trajectory having a total duration of 200 s, consisting of 3 space-time anchor locations, where each subsequent anchor location is 100 m from the previous location will be used (Fig. 2, Left). The progression of this abstract object's trajectory through space is artificial, with direct northward movement for the first 100 m and 100 s, followed by a 45-degree turn to the northeast for the remaining 100 m and 100 s. Given a point feature class representing this or any applicable trajectory, the user first selects appropriate values parameterizing the desired spatial and temporal resolution of the results, adjustments for object speed and analysis extent, as well as a target location on-disk for the results.
Per the selections reflected in Fig. 2 (right), the user has specified for space-time disks comprised of 10 × 10 m cells with a temporal interval (the duration in time which the disk captures, alternatively, its voxel height) of 20 s. Additional attenuation of the results is achieved by setting the ''velocity multiplier'' and ''expand edges factor'' parameters introduced in Section 2.2.1. The results geodatabase stored at the directory location specified in ''Output Folder for Prism FGDB'' contains a series of probabilistic space time disks which may be visualized in context or used in subsequent analyses (Fig. 3). Here, each respective probabilistic space-time disk, stored individually as raster datasets, represents a 20-second duration of occupancy probability for the tracked object, between 12:00:00 AM 1/1/2020 and 12:03:20 AM 1/1/2020. Returned space-time disks are exclusive of bounds at space time anchors, as disk areas converge to zero at known or observed space-time anchor locations. This is because it is assumed there exists no positional uncertainty to be related or estimated at these observed locations, where object location is known. With respect to the visualization shown in Fig. 3, cell locations with darker hues correspond to a higher probability of occupancy for the moving object over the disk interval at those cell locations. Discretized to 20 s intervals, an overlay of 8 PSTP disks modeling the 160 s of uncertainty between the start and terminal space-time anchors comprise the probability mass depicted in Fig. 3. Additional examples outlining usage of PySTPrism can be found in the user documentation bundled with the tool repository.

Impact
The functionality exposed in PySTPrism enables researchers and analysts from a variety of disciplines and industries to examine moving object trajectories using space-time prism approaches. Recent advances in location-aware technologies demonstrate a clear need for widely applicable methods analyzing movement data. PySTPrism provides an accessible GUI interface to proven methods from Time Geography using the Ar-cPy API driving the very popular ArcGIS Pro desktop GIS software. The PySTPrism toolbox is distributed freely under a permissive MIT open-source license. The terms of this license encourage both academic and commercial application of the PySTPrism feature set while simultaneously inviting collaboration from all parties on future versions of the toolbox. For these reasons, PySTPrism represents a significant reduction in the barrier to entry and requisite knowledge necessary to apply space-time prism methodologies to an unbounded class of research questions dealing with the movement process. PySTPrism seeks to proliferate space-time prism analysis among disciplines and industries yet to consider the time-geographic perspective on their data.
Possible applications for PySTPrism in disciplines removed from computational movement analysis are numerous. These range from emergency response studies, where for example missing-persons searches or readiness planning for medical emergencies at large or festival events may be aided by application of PSTP, to marketing studies interested in the potential paths of shoppers through markets. The Authors of PySTPrism expect the toolbox will be immediately beneficial to studies adjacent to or closely related to computational movement analysis. For example, forthcoming work examining the habitat use of Amazonian Black Skimmers (Rynchops niger cinerascens) using PSTP and CSP, as-implemented in the toolbox, represents a collaboration between PySTPrism authors and avian ecologists examining the species.
Additionally, PySTPrism as a reference implementation of the PSTP methodology encourages reproducibility in results within and between researchers, analysts, journalists etc. The straightforward construction of voxel-based space-time prisms from raster space-time disks also encourages extension of the methods included so far in PySTPrism, inviting alternative distance-decay functions for use in PSTP, or alternative aggregation approaches extending or altering CSP. Extensions incorporating contextual influences on movement from field-based time geography [29,33] are also invited as extensions to PySTPrism.

Conclusions
Voxel-based space-time prisms provide a computationally accessible and easy-to-interpret characterization of accessibility and space utilization for moving objects over time. The PyST-Prism toolbox makes voxel-based space-time prism methods available to a wide audience, encouraging reproducible application of space-time prisms to moving object trajectories of interest to a range of disciplines and industries. The toolbox materials are distributed under a permissive MIT open source license and have been implemented in Python 3.6 using the ArcPy interface to ArcGIS Pro 2.4 or newer versions. The functionality present in the toolbox may be accessed interactively using GUI interfaces to the included operations, or programmatically using Python's import routine, exposing the PySTPrism operations as Python objects. The toolbox provides four tools, two of which construct variants of the voxel-based, space-time prism, one which aggregates prism results on the basis of visit probability, and one tool used for basic trajectory data exploration. Data interchange formats and related considerations for the toolbox are intentionally simple and handled in terms of ESRI (ArcGIS Pro) data formats. Tools present in PySTPrism drive existing and forthcoming research examining the movement trajectories of animals for new knowledge about their habitat use patterns and interactions with their environment and each other. The release of PySTPrism encourages the widespread application of proven methods from time geography on new research questions.

Declaration of competing interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.