Trajectory Builder Example

Copyright (c) 2014-2020 National Technology and Engineering Solutions of Sandia, LLC. Under the terms of Contract DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government retains certain rights in this software.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Purpose: Sample code to assemble points into trajectories
When you read in points from a file, you need to build those points into trajectories. As we know, data can be noisy, therefore we want to filter our trajectories to have a minimum number of points and/or a certain time or distance between points in a trajectory. The trajectory builder does all of this.

Imports

[1]:
from tracktable.domain.terrestrial import TrajectoryPointReader        # Read points from file
from tracktable.analysis.assemble_trajectories import AssembleTrajectoryFromPoints  # Turn points into trajectories
from tracktable.core import data_directory

import os.path
import pprint

Requirements: In order to use the trajectory builder, we need a source that gives us data points in time sequential order. As with before, we can use the Point Reader.

[2]:
data_filename = os.path.join(data_directory(), 'SampleFlightsUS.csv')
inFile = open(data_filename, 'r')
reader = TrajectoryPointReader()
reader.input = inFile
reader.comment_character = '#'
reader.field_delimiter = ','
# Set columns for data we care about
reader.object_id_column = 0
reader.timestamp_column = 1
reader.coordinates[0] = 2
reader.coordinates[1] = 3
reader.set_real_field_column('Heading', 5)

Now that we have our points ready to be read, we need to create a builder to take those points and form trajectories.

For now, we are going to leave the parameters at default.

[3]:
builder = AssembleTrajectoryFromPoints()
builder.input = reader
builder.minimum_length = 3                  # An example of how to set the minimum number of points for each trajectory. Default is 2.

That’s it! Now we can play with the trajectories. As before with the point reader by itself, no data is loaded until you interact with the data.

Let’s start with seeing how many trajectories we have. We can do this, and see what they look like by dumping the trajectories to a list.

[4]:
traj = list(builder.trajectories())
print(len(traj))
INFO:tracktable.analysis.assemble_trajectoriesAssembleTrajectoryFromPoints:New trajectories will be declared after a separation of None distance units between two points or a time lapse of at least 0:30:00 (hours, minutes, seconds).
INFO:tracktable.analysis.assemble_trajectoriesAssembleTrajectoryFromPoints:Trajectories with fewer than 3 points will be discarded.
INFO:tracktable.analysis.assemble_trajectoriesAssembleTrajectoryFromPoints:Done assembling trajectories. 29 trajectories produced and 0 discarded for having fewer than 3 points.
29

Looking at our first trajectory, we can see all the points included. See how they are in time sequential order and share the same object_id, which is what we would expect from a trajectory.

[5]:
print(*traj[0])
[JJJ010@ 2004-12-10 14:14:40: (-111.501, 47.3697) Properties: ( {Heading [real]: 134})] [JJJ010@ 2004-12-10 14:15:41: (-111.528, 47.3353) Properties: ( {Heading [real]: 134})] [JJJ010@ 2004-12-10 14:16:43: (-111.551, 47.3039) Properties: ( {Heading [real]: 118})] [JJJ010@ 2004-12-10 14:17:45: (-111.575, 47.2719) Properties: ( {Heading [real]: 121})] [JJJ010@ 2004-12-10 14:18:47: (-111.599, 47.2403) Properties: ( {Heading [real]: 120})] [JJJ010@ 2004-12-10 14:19:49: (-111.621, 47.2081) Properties: ( {Heading [real]: 120})] [JJJ010@ 2004-12-10 14:20:50: (-111.646, 47.1761) Properties: ( {Heading [real]: 124})] [JJJ010@ 2004-12-10 14:21:52: (-111.676, 47.1375) Properties: ( {Heading [real]: 147})] [JJJ010@ 2004-12-10 14:22:54: (-111.699, 47.1036) Properties: ( {Heading [real]: 126})] [JJJ010@ 2004-12-10 14:23:56: (-111.726, 47.0692) Properties: ( {Heading [real]: 132})] [JJJ010@ 2004-12-10 14:24:58: (-111.752, 47.0336) Properties: ( {Heading [real]: 134})] [JJJ010@ 2004-12-10 14:26:01: (-111.778, 46.9972) Properties: ( {Heading [real]: 135})] [JJJ010@ 2004-12-10 14:27:02: (-111.804, 46.9608) Properties: ( {Heading [real]: 139})] [JJJ010@ 2004-12-10 14:28:04: (-111.838, 46.9175) Properties: ( {Heading [real]: 166})] [JJJ010@ 2004-12-10 14:29:06: (-111.863, 46.8822) Properties: ( {Heading [real]: 132})] [JJJ010@ 2004-12-10 14:30:08: (-111.889, 46.8464) Properties: ( {Heading [real]: 135})] [JJJ010@ 2004-12-10 14:31:10: (-111.914, 46.8106) Properties: ( {Heading [real]: 134})] [JJJ010@ 2004-12-10 14:32:12: (-111.942, 46.7742) Properties: ( {Heading [real]: 139})] [JJJ010@ 2004-12-10 14:33:14: (-111.967, 46.7386) Properties: ( {Heading [real]: 133})] [JJJ010@ 2004-12-10 14:34:16: (-112.001, 46.6944) Properties: ( {Heading [real]: 169})] [JJJ010@ 2004-12-10 14:35:18: (-112.025, 46.6581) Properties: ( {Heading [real]: 135})] [JJJ010@ 2004-12-10 14:36:20: (-112.052, 46.6211) Properties: ( {Heading [real]: 140})] [JJJ010@ 2004-12-10 14:37:22: (-112.08, 46.5833) Properties: ( {Heading [real]: 143})] [JJJ010@ 2004-12-10 14:38:24: (-112.108, 46.5439) Properties: ( {Heading [real]: 148})] [JJJ010@ 2004-12-10 14:39:26: (-112.134, 46.5067) Properties: ( {Heading [real]: 139})] [JJJ010@ 2004-12-10 14:40:28: (-112.165, 46.4619) Properties: ( {Heading [real]: 168})] [JJJ010@ 2004-12-10 14:41:30: (-112.194, 46.4228) Properties: ( {Heading [real]: 148})] [JJJ010@ 2004-12-10 14:42:32: (-112.232, 46.3742) Properties: ( {Heading [real]: 187})] [JJJ010@ 2004-12-10 14:43:34: (-112.267, 46.3225) Properties: ( {Heading [real]: 193})] [JJJ010@ 2004-12-10 14:44:36: (-112.305, 46.2683) Properties: ( {Heading [real]: 204})] [JJJ010@ 2004-12-10 14:45:38: (-112.355, 46.2008) Properties: ( {Heading [real]: 257})] [JJJ010@ 2004-12-10 14:46:40: (-112.395, 46.1428) Properties: ( {Heading [real]: 217})] [JJJ010@ 2004-12-10 14:47:42: (-112.436, 46.0844) Properties: ( {Heading [real]: 220})] [JJJ010@ 2004-12-10 14:48:44: (-112.478, 46.0267) Properties: ( {Heading [real]: 219})] [JJJ010@ 2004-12-10 14:49:46: (-112.518, 45.9681) Properties: ( {Heading [real]: 219})] [JJJ010@ 2004-12-10 14:50:48: (-112.56, 45.9083) Properties: ( {Heading [real]: 225})] [JJJ010@ 2004-12-10 14:51:50: (-112.61, 45.8383) Properties: ( {Heading [real]: 264})] [JJJ010@ 2004-12-10 14:52:52: (-112.653, 45.7808) Properties: ( {Heading [real]: 219})] [JJJ010@ 2004-12-10 14:53:54: (-112.693, 45.72) Properties: ( {Heading [real]: 226})] [JJJ010@ 2004-12-10 14:54:56: (-112.719, 45.655) Properties: ( {Heading [real]: 228})] [JJJ010@ 2004-12-10 14:55:58: (-112.632, 45.6189) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 14:57:00: (-112.563, 45.5775) Properties: ( {Heading [real]: 215})] [JJJ010@ 2004-12-10 14:58:02: (-112.652, 45.5803) Properties: ( {Heading [real]: 211})] [JJJ010@ 2004-12-10 14:59:04: (-112.719, 45.6153) Properties: ( {Heading [real]: 198})] [JJJ010@ 2004-12-10 15:00:07: (-112.721, 45.6864) Properties: ( {Heading [real]: 237})] [JJJ010@ 2004-12-10 15:01:09: (-112.721, 45.7581) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:02:11: (-112.724, 45.8308) Properties: ( {Heading [real]: 246})] [JJJ010@ 2004-12-10 15:03:14: (-112.727, 45.9019) Properties: ( {Heading [real]: 237})] [JJJ010@ 2004-12-10 15:04:15: (-112.729, 45.9744) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 15:05:17: (-112.731, 46.0644) Properties: ( {Heading [real]: 305})] [JJJ010@ 2004-12-10 15:07:21: (-112.737, 46.2106) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 15:08:23: (-112.74, 46.2847) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 15:09:25: (-112.739, 46.3592) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 15:10:27: (-112.742, 46.4308) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:11:29: (-112.746, 46.5192) Properties: ( {Heading [real]: 299})] [JJJ010@ 2004-12-10 15:12:31: (-112.747, 46.5933) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 15:13:33: (-112.75, 46.6672) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 15:14:35: (-112.753, 46.7411) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 15:15:37: (-112.756, 46.815) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 15:16:39: (-112.757, 46.8894) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 15:17:41: (-112.759, 46.98) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 15:18:43: (-112.762, 47.0536) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 15:19:45: (-112.764, 47.1294) Properties: ( {Heading [real]: 256})] [JJJ010@ 2004-12-10 15:20:47: (-112.767, 47.2031) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 15:21:49: (-112.769, 47.2778) Properties: ( {Heading [real]: 253})] [JJJ010@ 2004-12-10 15:22:51: (-112.8, 47.3469) Properties: ( {Heading [real]: 244})] [JJJ010@ 2004-12-10 15:23:53: (-112.868, 47.3569) Properties: ( {Heading [real]: 159})] [JJJ010@ 2004-12-10 15:24:55: (-112.89, 47.2806) Properties: ( {Heading [real]: 263})] [JJJ010@ 2004-12-10 15:25:57: (-112.888, 47.2086) Properties: ( {Heading [real]: 244})] [JJJ010@ 2004-12-10 15:26:59: (-112.885, 47.1372) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:28:01: (-112.882, 47.0672) Properties: ( {Heading [real]: 237})] [JJJ010@ 2004-12-10 15:29:03: (-112.881, 46.9956) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:30:05: (-112.878, 46.91) Properties: ( {Heading [real]: 290})] [JJJ010@ 2004-12-10 15:31:07: (-112.875, 46.8381) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 15:32:09: (-112.873, 46.7658) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 15:33:11: (-112.871, 46.6947) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 15:34:14: (-112.868, 46.6236) Properties: ( {Heading [real]: 237})] [JJJ010@ 2004-12-10 15:35:16: (-112.866, 46.5511) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 15:36:18: (-112.863, 46.4653) Properties: ( {Heading [real]: 290})] [JJJ010@ 2004-12-10 15:37:20: (-112.861, 46.3992) Properties: ( {Heading [real]: 224})] [JJJ010@ 2004-12-10 15:38:22: (-112.86, 46.3133) Properties: ( {Heading [real]: 291})] [JJJ010@ 2004-12-10 15:39:24: (-112.856, 46.2414) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 15:40:26: (-112.853, 46.1703) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 15:41:28: (-112.851, 46.0969) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 15:42:30: (-112.849, 46.0253) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:43:32: (-112.845, 45.9528) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 15:44:34: (-112.842, 45.8672) Properties: ( {Heading [real]: 290})] [JJJ010@ 2004-12-10 15:45:36: (-112.841, 45.7947) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 15:46:38: (-112.838, 45.7231) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 15:47:40: (-112.837, 45.6506) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 15:48:42: (-112.876, 45.5911) Properties: ( {Heading [real]: 221})] [JJJ010@ 2004-12-10 15:49:44: (-112.94, 45.5817) Properties: ( {Heading [real]: 155})] [JJJ010@ 2004-12-10 15:50:46: (-112.951, 45.6711) Properties: ( {Heading [real]: 304})] [JJJ010@ 2004-12-10 15:51:48: (-112.952, 45.7472) Properties: ( {Heading [real]: 257})] [JJJ010@ 2004-12-10 15:52:50: (-112.955, 45.8225) Properties: ( {Heading [real]: 255})] [JJJ010@ 2004-12-10 15:53:52: (-112.958, 45.8983) Properties: ( {Heading [real]: 256})] [JJJ010@ 2004-12-10 15:54:54: (-112.962, 45.9736) Properties: ( {Heading [real]: 255})] [JJJ010@ 2004-12-10 15:55:56: (-112.963, 46.0497) Properties: ( {Heading [real]: 257})] [JJJ010@ 2004-12-10 15:56:58: (-112.965, 46.1253) Properties: ( {Heading [real]: 256})] [JJJ010@ 2004-12-10 15:58:00: (-112.97, 46.215) Properties: ( {Heading [real]: 304})] [JJJ010@ 2004-12-10 15:59:02: (-112.973, 46.2908) Properties: ( {Heading [real]: 256})] [JJJ010@ 2004-12-10 16:00:04: (-112.973, 46.3686) Properties: ( {Heading [real]: 263})] [JJJ010@ 2004-12-10 16:01:06: (-112.977, 46.4481) Properties: ( {Heading [real]: 269})] [JJJ010@ 2004-12-10 16:02:08: (-112.98, 46.5233) Properties: ( {Heading [real]: 254})] [JJJ010@ 2004-12-10 16:03:10: (-112.982, 46.6003) Properties: ( {Heading [real]: 260})] [JJJ010@ 2004-12-10 16:04:12: (-112.986, 46.6764) Properties: ( {Heading [real]: 258})] [JJJ010@ 2004-12-10 16:05:14: (-112.989, 46.7619) Properties: ( {Heading [real]: 289})] [JJJ010@ 2004-12-10 16:07:18: (-112.994, 46.9122) Properties: ( {Heading [real]: 254})] [JJJ010@ 2004-12-10 16:08:21: (-112.997, 46.9878) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 16:09:23: (-112.999, 47.0633) Properties: ( {Heading [real]: 255})] [JJJ010@ 2004-12-10 16:10:25: (-113.003, 47.1539) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 16:11:27: (-113.006, 47.2294) Properties: ( {Heading [real]: 255})] [JJJ010@ 2004-12-10 16:12:29: (-113.025, 47.2992) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 16:13:31: (-113.109, 47.315) Properties: ( {Heading [real]: 200})] [JJJ010@ 2004-12-10 16:14:33: (-113.193, 47.3242) Properties: ( {Heading [real]: 195})] [JJJ010@ 2004-12-10 16:15:35: (-113.28, 47.3344) Properties: ( {Heading [real]: 202})] [JJJ010@ 2004-12-10 16:16:37: (-113.383, 47.3469) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 16:17:39: (-113.469, 47.3544) Properties: ( {Heading [real]: 199})] [JJJ010@ 2004-12-10 16:18:41: (-113.557, 47.36) Properties: ( {Heading [real]: 202})] [JJJ010@ 2004-12-10 16:19:43: (-113.642, 47.3656) Properties: ( {Heading [real]: 196})] [JJJ010@ 2004-12-10 16:20:45: (-113.685, 47.3128) Properties: ( {Heading [real]: 204})] [JJJ010@ 2004-12-10 16:21:47: (-113.682, 47.2422) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 16:22:49: (-113.678, 47.1578) Properties: ( {Heading [real]: 286})] [JJJ010@ 2004-12-10 16:23:51: (-113.675, 47.0861) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 16:24:53: (-113.671, 47.015) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 16:25:55: (-113.667, 46.9433) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 16:27:59: (-113.661, 46.8) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 16:29:01: (-113.656, 46.7125) Properties: ( {Heading [real]: 296})] [JJJ010@ 2004-12-10 16:30:03: (-113.653, 46.6422) Properties: ( {Heading [real]: 238})] [JJJ010@ 2004-12-10 16:31:05: (-113.649, 46.57) Properties: ( {Heading [real]: 244})] [JJJ010@ 2004-12-10 16:32:07: (-113.646, 46.4992) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 16:33:09: (-113.642, 46.4281) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 16:34:11: (-113.64, 46.3569) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 16:35:13: (-113.635, 46.2711) Properties: ( {Heading [real]: 290})] [JJJ010@ 2004-12-10 16:36:15: (-113.632, 46.2) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 16:37:17: (-113.63, 46.1219) Properties: ( {Heading [real]: 264})] [JJJ010@ 2004-12-10 16:38:19: (-113.626, 46.0506) Properties: ( {Heading [real]: 241})] [JJJ010@ 2004-12-10 16:39:21: (-113.623, 45.9797) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 16:40:24: (-113.619, 45.9078) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 16:41:26: (-113.616, 45.8356) Properties: ( {Heading [real]: 244})] [JJJ010@ 2004-12-10 16:42:28: (-113.612, 45.7631) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 16:43:27: (-113.608, 45.6769) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 16:44:32: (-113.556, 45.6172) Properties: ( {Heading [real]: 225})] [JJJ010@ 2004-12-10 16:45:34: (-113.477, 45.6708) Properties: ( {Heading [real]: 260})] [JJJ010@ 2004-12-10 16:46:36: (-113.401, 45.6414) Properties: ( {Heading [real]: 205})] [JJJ010@ 2004-12-10 16:47:38: (-113.329, 45.6028) Properties: ( {Heading [real]: 215})] [JJJ010@ 2004-12-10 16:48:40: (-113.215, 45.6303) Properties: ( {Heading [real]: 285})] [JJJ010@ 2004-12-10 16:49:42: (-113.072, 45.6603) Properties: ( {Heading [real]: 353})] [JJJ010@ 2004-12-10 16:50:44: (-112.951, 45.6878) Properties: ( {Heading [real]: 301})] [JJJ010@ 2004-12-10 16:51:46: (-112.83, 45.7164) Properties: ( {Heading [real]: 302})] [JJJ010@ 2004-12-10 16:52:48: (-112.706, 45.7422) Properties: ( {Heading [real]: 306})] [JJJ010@ 2004-12-10 16:53:50: (-112.584, 45.7708) Properties: ( {Heading [real]: 304})] [JJJ010@ 2004-12-10 16:54:52: (-112.459, 45.7972) Properties: ( {Heading [real]: 308})] [JJJ010@ 2004-12-10 16:55:54: (-112.335, 45.8244) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 16:56:56: (-112.187, 45.8569) Properties: ( {Heading [real]: 366})] [JJJ010@ 2004-12-10 16:57:58: (-112.065, 45.8853) Properties: ( {Heading [real]: 303})] [JJJ010@ 2004-12-10 16:59:00: (-111.94, 45.9106) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 17:00:02: (-111.816, 45.9392) Properties: ( {Heading [real]: 307})] [JJJ010@ 2004-12-10 17:01:04: (-111.692, 45.9661) Properties: ( {Heading [real]: 306})] [JJJ010@ 2004-12-10 17:02:06: (-111.568, 45.9936) Properties: ( {Heading [real]: 306})] [JJJ010@ 2004-12-10 17:03:08: (-111.442, 46.0231) Properties: ( {Heading [real]: 312})] [JJJ010@ 2004-12-10 17:04:10: (-111.291, 46.0558) Properties: ( {Heading [real]: 372})] [JJJ010@ 2004-12-10 17:05:12: (-111.165, 46.0853) Properties: ( {Heading [real]: 312})] [JJJ010@ 2004-12-10 17:07:17: (-111.071, 46.0042) Properties: ( {Heading [real]: 174})] [JJJ010@ 2004-12-10 17:08:19: (-110.966, 45.9964) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:16:35: (-110.918, 46.5919) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 17:17:37: (-110.918, 46.6658) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 17:18:39: (-110.919, 46.755) Properties: ( {Heading [real]: 302})] [JJJ010@ 2004-12-10 17:19:41: (-110.918, 46.8286) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 17:20:43: (-110.918, 46.9022) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 17:21:45: (-110.919, 46.9756) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:22:47: (-110.918, 47.0489) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:23:49: (-110.918, 47.1222) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:24:51: (-110.915, 47.2094) Properties: ( {Heading [real]: 295})] [JJJ010@ 2004-12-10 17:25:53: (-110.934, 47.2747) Properties: ( {Heading [real]: 225})] [JJJ010@ 2004-12-10 17:26:55: (-110.994, 47.2997) Properties: ( {Heading [real]: 161})] [JJJ010@ 2004-12-10 17:27:57: (-111.04, 47.245) Properties: ( {Heading [real]: 213})] [JJJ010@ 2004-12-10 17:28:59: (-111.041, 47.1714) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 17:30:02: (-111.043, 47.0975) Properties: ( {Heading [real]: 246})] [JJJ010@ 2004-12-10 17:31:04: (-111.041, 47.0106) Properties: ( {Heading [real]: 294})] [JJJ010@ 2004-12-10 17:32:06: (-111.043, 46.9372) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:33:08: (-111.043, 46.8642) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 17:34:10: (-111.044, 46.7908) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 17:35:12: (-111.043, 46.7167) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 17:36:14: (-111.039, 46.6444) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 17:37:16: (-111.039, 46.5558) Properties: ( {Heading [real]: 300})] [JJJ010@ 2004-12-10 17:38:19: (-111.039, 46.4817) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 17:39:20: (-111.041, 46.41) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 17:40:22: (-111.041, 46.3336) Properties: ( {Heading [real]: 258})] [JJJ010@ 2004-12-10 17:41:24: (-111.041, 46.2617) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 17:42:26: (-111.04, 46.1878) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 17:43:28: (-111.079, 46.1136) Properties: ( {Heading [real]: 267})] [JJJ010@ 2004-12-10 17:44:30: (-111.138, 46.0719) Properties: ( {Heading [real]: 197})] [JJJ010@ 2004-12-10 17:45:32: (-111.155, 46.1308) Properties: ( {Heading [real]: 203})] [JJJ010@ 2004-12-10 17:46:34: (-111.161, 46.2008) Properties: ( {Heading [real]: 237})] [JJJ010@ 2004-12-10 17:47:36: (-111.16, 46.275) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 17:48:38: (-111.16, 46.3489) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 17:49:40: (-111.162, 46.4378) Properties: ( {Heading [real]: 301})] [JJJ010@ 2004-12-10 17:50:42: (-111.16, 46.5083) Properties: ( {Heading [real]: 238})] [JJJ010@ 2004-12-10 17:51:44: (-111.161, 46.5806) Properties: ( {Heading [real]: 245})] [JJJ010@ 2004-12-10 17:52:46: (-111.161, 46.6517) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 17:53:48: (-111.163, 46.7253) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 17:54:50: (-111.163, 46.7989) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 17:55:52: (-111.162, 46.8892) Properties: ( {Heading [real]: 306})] [JJJ010@ 2004-12-10 17:56:54: (-111.162, 46.9636) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 17:57:56: (-111.163, 47.04) Properties: ( {Heading [real]: 258})] [JJJ010@ 2004-12-10 17:58:59: (-111.162, 47.1131) Properties: ( {Heading [real]: 243})] [JJJ010@ 2004-12-10 18:01:03: (-111.202, 47.2375) Properties: ( {Heading [real]: 215})] [JJJ010@ 2004-12-10 18:02:05: (-111.275, 47.1861) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 18:03:07: (-111.28, 47.1131) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 18:04:09: (-111.279, 47.0411) Properties: ( {Heading [real]: 244})] [JJJ010@ 2004-12-10 18:05:11: (-111.279, 46.9675) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 18:07:15: (-111.278, 46.8211) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:08:17: (-111.278, 46.7331) Properties: ( {Heading [real]: 298})] [JJJ010@ 2004-12-10 18:09:19: (-111.276, 46.6594) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 18:10:21: (-111.276, 46.5864) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 18:11:23: (-111.275, 46.5131) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:12:25: (-111.275, 46.4344) Properties: ( {Heading [real]: 266})] [JJJ010@ 2004-12-10 18:13:27: (-111.275, 46.3592) Properties: ( {Heading [real]: 254})] [JJJ010@ 2004-12-10 18:14:29: (-111.275, 46.2842) Properties: ( {Heading [real]: 254})] [JJJ010@ 2004-12-10 18:15:31: (-111.274, 46.1958) Properties: ( {Heading [real]: 299})] [JJJ010@ 2004-12-10 18:16:33: (-111.273, 46.1214) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 18:17:35: (-111.274, 46.0475) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 18:18:37: (-111.274, 45.9725) Properties: ( {Heading [real]: 254})] [JJJ010@ 2004-12-10 18:19:39: (-111.274, 45.8992) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:20:41: (-111.321, 45.8253) Properties: ( {Heading [real]: 273})] [JJJ010@ 2004-12-10 18:21:43: (-111.38, 45.8469) Properties: ( {Heading [real]: 157})] [JJJ010@ 2004-12-10 18:22:45: (-111.388, 45.9183) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 18:23:47: (-111.386, 45.9919) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 18:24:49: (-111.386, 46.0661) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 18:25:51: (-111.387, 46.14) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 18:26:53: (-111.388, 46.2131) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 18:27:55: (-111.387, 46.3017) Properties: ( {Heading [real]: 300})] [JJJ010@ 2004-12-10 18:28:58: (-111.389, 46.3775) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 18:30:00: (-111.388, 46.445) Properties: ( {Heading [real]: 228})] [JJJ010@ 2004-12-10 18:31:02: (-111.388, 46.5206) Properties: ( {Heading [real]: 256})] [JJJ010@ 2004-12-10 18:32:04: (-111.389, 46.61) Properties: ( {Heading [real]: 302})] [JJJ010@ 2004-12-10 18:33:06: (-111.389, 46.6844) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 18:34:08: (-111.391, 46.7603) Properties: ( {Heading [real]: 257})] [JJJ010@ 2004-12-10 18:35:10: (-111.391, 46.8347) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 18:36:12: (-111.392, 46.9081) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:37:14: (-111.393, 46.9819) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 18:38:16: (-111.393, 47.0717) Properties: ( {Heading [real]: 304})] [JJJ010@ 2004-12-10 18:39:18: (-111.393, 47.1461) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 18:40:20: (-111.428, 47.2106) Properties: ( {Heading [real]: 232})] [JJJ010@ 2004-12-10 18:41:22: (-111.491, 47.2411) Properties: ( {Heading [real]: 178})] [JJJ010@ 2004-12-10 18:42:24: (-111.518, 47.1778) Properties: ( {Heading [real]: 223})] [JJJ010@ 2004-12-10 18:43:26: (-111.516, 47.1044) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:44:28: (-111.515, 47.0175) Properties: ( {Heading [real]: 294})] [JJJ010@ 2004-12-10 18:45:30: (-111.517, 46.9467) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 18:46:32: (-111.515, 46.8753) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 18:47:34: (-111.514, 46.8036) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 18:48:36: (-111.514, 46.73) Properties: ( {Heading [real]: 249})] [JJJ010@ 2004-12-10 18:49:38: (-111.514, 46.6567) Properties: ( {Heading [real]: 248})] [JJJ010@ 2004-12-10 18:50:40: (-111.512, 46.5697) Properties: ( {Heading [real]: 294})] [JJJ010@ 2004-12-10 18:51:42: (-111.512, 46.4958) Properties: ( {Heading [real]: 250})] [JJJ010@ 2004-12-10 18:52:45: (-111.51, 46.4261) Properties: ( {Heading [real]: 232})] [JJJ010@ 2004-12-10 18:53:47: (-111.511, 46.3392) Properties: ( {Heading [real]: 294})] [JJJ010@ 2004-12-10 18:54:49: (-111.509, 46.2661) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 18:55:51: (-111.508, 46.1956) Properties: ( {Heading [real]: 238})] [JJJ010@ 2004-12-10 18:56:53: (-111.508, 46.1253) Properties: ( {Heading [real]: 238})] [JJJ010@ 2004-12-10 18:57:55: (-111.507, 46.0544) Properties: ( {Heading [real]: 240})] [JJJ010@ 2004-12-10 18:58:57: (-111.506, 45.9828) Properties: ( {Heading [real]: 242})] [JJJ010@ 2004-12-10 18:59:59: (-111.506, 45.8958) Properties: ( {Heading [real]: 294})] [JJJ010@ 2004-12-10 19:01:01: (-111.508, 45.8228) Properties: ( {Heading [real]: 247})] [JJJ010@ 2004-12-10 19:02:03: (-111.509, 45.7442) Properties: ( {Heading [real]: 266})] [JJJ010@ 2004-12-10 19:03:05: (-111.549, 45.6875) Properties: ( {Heading [real]: 214})] [JJJ010@ 2004-12-10 19:04:07: (-111.612, 45.7292) Properties: ( {Heading [real]: 205})] [JJJ010@ 2004-12-10 19:05:09: (-111.678, 45.6767) Properties: ( {Heading [real]: 236})] [JJJ010@ 2004-12-10 19:07:13: (-111.687, 45.8181) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 19:08:15: (-111.671, 45.8961) Properties: ( {Heading [real]: 267})] [JJJ010@ 2004-12-10 19:09:17: (-111.656, 45.9742) Properties: ( {Heading [real]: 267})] [JJJ010@ 2004-12-10 19:10:19: (-111.642, 46.0519) Properties: ( {Heading [real]: 265})] [JJJ010@ 2004-12-10 19:11:31: (-111.627, 46.1319) Properties: ( {Heading [real]: 235})] [JJJ010@ 2004-12-10 19:12:23: (-111.612, 46.2117) Properties: ( {Heading [real]: 325})] [JJJ010@ 2004-12-10 19:13:25: (-111.594, 46.3067) Properties: ( {Heading [real]: 324})] [JJJ010@ 2004-12-10 19:14:27: (-111.578, 46.3881) Properties: ( {Heading [real]: 278})] [JJJ010@ 2004-12-10 19:15:29: (-111.563, 46.4728) Properties: ( {Heading [real]: 289})] [JJJ010@ 2004-12-10 19:16:31: (-111.547, 46.5531) Properties: ( {Heading [real]: 274})] [JJJ010@ 2004-12-10 19:17:34: (-111.532, 46.6314) Properties: ( {Heading [real]: 263})] [JJJ010@ 2004-12-10 19:18:36: (-111.518, 46.7078) Properties: ( {Heading [real]: 260})] [JJJ010@ 2004-12-10 19:19:38: (-111.504, 46.7814) Properties: ( {Heading [real]: 251})] [JJJ010@ 2004-12-10 19:20:40: (-111.488, 46.8686) Properties: ( {Heading [real]: 297})] [JJJ010@ 2004-12-10 19:21:42: (-111.476, 46.9367) Properties: ( {Heading [real]: 232})] [JJJ010@ 2004-12-10 19:22:44: (-111.463, 47.0064) Properties: ( {Heading [real]: 238})] [JJJ010@ 2004-12-10 19:23:46: (-111.448, 47.0764) Properties: ( {Heading [real]: 239})] [JJJ010@ 2004-12-10 19:24:48: (-111.436, 47.1408) Properties: ( {Heading [real]: 219})] [JJJ010@ 2004-12-10 19:25:50: (-111.425, 47.2042) Properties: ( {Heading [real]: 216})] [JJJ010@ 2004-12-10 19:26:52: (-111.41, 47.2781) Properties: ( {Heading [real]: 252})] [JJJ010@ 2004-12-10 19:27:54: (-111.397, 47.3389) Properties: ( {Heading [real]: 208})] [JJJ010@ 2004-12-10 19:28:56: (-111.387, 47.3947) Properties: ( {Heading [real]: 190})] [JJJ010@ 2004-12-10 19:29:58: (-111.362, 47.4414) Properties: ( {Heading [real]: 168})] [JJJ010@ 2004-12-10 19:31:00: (-111.319, 47.4808) Properties: ( {Heading [real]: 165})] [JJJ010@ 2004-12-10 19:32:02: (-111.337, 47.5011) Properties: ( {Heading [real]: 80})] [JJJ010@ 2004-12-10 19:33:04: (-111.371, 47.4781) Properties: ( {Heading [real]: 110})]
Here is an example of how to access specific information within a trajectory. We show how to get:
  1. Core data such as object_id
  2. Longitude and Latitude
  3. Custom columns such as ‘Heading’
[6]:
print('Object_id: ' + traj[0][0].object_id)                     # Trajectory 0 in list, point 0 in trajectory
print('Latitude: ' + str(traj[0][0][1]))                        # Trajectory 0 in list, point 0 in trajectory, coordinate[1]
print('Heading: ' + str(traj[0][0].properties['Heading']))
Object_id: JJJ010
Latitude: 47.3697
Heading: 134.0
[7]:
inFile.close()
The builder has multiple parameters that can be changed. For example, we can
  1. Change the minimum number of points needed to form a trajectory. (builder.minimum_length = 10)
  2. Change the minimum distance between points. (builder.separation_stance = 100)
  3. Change the minimum time between points. (builder.separation_time = datetime.timedelta(minutes=30))