Data Generation

When real or quality trajectory data is not available, it is possible to generate data sets given some constraints. Current methods for auto generation of trajectories are based on using airports or bounding boxes as the start and end points of the trajectory. Current methods for generating heatmap points are based on placing points around a given set of largest cities.

Generate Airport-Based Trajectories

Tracktable includes data on many airports around the world. This data includes latitude/longitude, airport codes, and size rankings based on traffic. This data is available via the tracktable.info.airports package. The data generation package provides methods for generating direct trajectories between pairs of airports or between sets of airports. This can allow the user to simulate air traffic across the whole world or in a specific locality.

Important constraints for generating trajectories include speed, time between points, and the minimum number of points that make up the trajectory.

Generate A Single Trajectory Between Airports

This example shows how to retrieve airport data using airport codes and create a single trajectory.

 1from datetime import datetime
 2from tracktable.data_generators import trajectory
 3from tracktable.info import airports
 4
 5ABQ_AIRPORT = airports.airport_information("ABQ")
 6DEN_AIRPORT = airports.airport_information("DEN")
 7new_trajectory = trajectory.generate_airport_trajectory(
 8                                          start_airport=ABQ_AIRPORT,
 9                                          end_airport=DEN_AIRPORT,
10                                          start_time=datetime.now(),
11                                          object_id='ABQ-DEN',
12                                          desired_speed=400,
13                                          seconds_between_points=60,
14                                          minimum_num_points=10)

Generate Multiple Trajectories Between Lists Of Airports

This example shows how to retrieve a set of the ten largest airports and use it as input to the tracktable.data_generators.trajectory package. Alternatively, the tracktable.info.airports package could be used directly to get airports based on other criteria. The result will be a list of airports that start and end at random airports sampled from the given list.

1from tracktable.data_generators import trajectory
2
3ten_largest_airports = trajectory.n_largest_airports(10)
4new_trajectories = trajectory.generate_random_airport_trajectories(
5                                       start_airport_list=ten_largest_airports[:5],
6                                       end_airport_list=ten_largest_airports[5:],
7                                       num_paths=5,
8                                       desired_speed=400,
9                                       seconds_between_points=60)

Generate Multiple Trajectories Between Random Airports

This example shows the method call for generating trajectories between completely random airports. This is done by not defining lists for the starting and ending points.

1from tracktable.data_generators import trajectory
2
3new_trajectories = trajectory.generate_random_airport_trajectories(
4                                   start_airport_list=None,
5                                   end_airport_list=[],
6                                   num_paths=5,
7                                   desired_speed=400,
8                                   seconds_between_points=60)

Generate Trajectories Between Bounding Boxes

Bounding boxes can be created and used as the start and end points as part of trajectory generation. Points within the bounding boxes are randomly generated and used as the endpoints.

The constraints for creating these trajectories are identical to the ones used in the airport examples above.

This example shows one method for creating the bounding boxes and using them as input to generate a list of 5 new trajectories.

 1 from datetime import datetime
 2 from tracktable.data_generators import trajectory
 3 from tracktable.domain.terrestrial import TrajectoryPoint as TerrestrialTrajectoryPoint
 4
 5 bbox_type = TerrestrialTrajectoryPoint.domain_classes['BoundingBox']
 6 starting_min_corner = TerrestrialTrajectoryPoint.domain_classes['BasePoint']()
 7 starting_max_corner = TerrestrialTrajectoryPoint.domain_classes['BasePoint']()
 8 ending_min_corner = TerrestrialTrajectoryPoint.domain_classes['BasePoint']()
 9 ending_max_corner = TerrestrialTrajectoryPoint.domain_classes['BasePoint']()
10
11 albuquerque = TerrestrialTrajectoryPoint(-106.6504, 35.0844)
12 san_francisco = TerrestrialTrajectoryPoint( -122.4194, 37.7749)
13 atlanta = TerrestrialTrajectoryPoint(-84.42806, 33.636719)
14 miami = TerrestrialTrajectoryPoint(-80.290556, 25.79325)
15
16 starting_min_corner[0] = san_francisco[0]
17 starting_min_corner[1] = albuquerque[1]
18 starting_max_corner[0] = albuquerque[0]
19 starting_max_corner[1] = san_francisco[1]
20
21 ending_min_corner[0] = atlanta[0]
22 ending_min_corner[1] = miami[1]
23 ending_max_corner[0] = miami[0]
24 ending_max_corner[1] = atlanta[1]
25
26 starting_bbox = bbox_type(starting_min_corner, starting_max_corner)
27 ending_bbox = bbox_type(ending_min_corner, ending_max_corner)
28
29 new_trajectories = trajectory.generate_bbox_trajectories(
30                                                 starting_bbox,
31                                                 ending_bbox,
32                                                 5,
33                                                 'BBOXTST',
34                                                 start_time=datetime.now(),
35                                                 desired_speed=400,
36                                                 seconds_between_points=60,
37                                                 minimum_num_points=10)

Generate Port-Based Trajectories

Todo

Create this section once Tracktable is able to intelligently generate trajectories between ports

Generate City-Based Heatmap Points

Tracktable includes data on many large cities around the world. This data includes toponymic information and offical standard names. This data is available via the tracktable.info.cities package. The data generation package provides methods for generating heatmap points around a given number of large cities.

Important constraints for generating heatmap points include location and the minimum number of points that that will be generated around in a given radius around the given cities.

Generate Heatmap Points Around Cities

This example shows how to generate heatmap points around 10 of the largest cities.

Note

The generated heatmap can be saved to a file by setting the write_file flag.

1from tracktable.data_generators import heatmap_point
2
3heatmap = heatmap_point.generate_heatmap_points(
4                                          num_cities=10,
5                                          num_points_per_city=30,
6                                          write_file=False,
7                                          outfilename='SampleHeatmapPoints.csv')