Main modules#
mtldp.meta
#
This module contains three types of data structures:
Traffic network
Trajectory
SPaT
You can import the related class from mtldp.meta.${type}
. For example, if
you want to import the trajectory dictionary class, you can use the
following code:
from mtldp.meta.Trajectory import TrajectoryDict
If you want to import the Node
class, you can use the following
code:
from mtldp.meta.TrafficNetwork import Node
The data structure in this module is more like pure data classes, which don’t have any complex method to manipulate the data. So, we need the other module to interact with these data.
mtldp.utils
#
This module provides a lot of useful functions that are related to these three basic data structures. These functions can be divided into the following sub-modules:
aggregation
config
converter
database
io
time
In mtldp.utils.aggregation
, there are some functions to aggregate
the trajectory index based on different geographical resolutions. For
example, you can aggregate the trajectory by the movement, or you can
aggregate the trajectory by the arterial.
In mtldp.utils.config
, there are two Region classes to help you
manage your application’s input and output and provide some command line
tools to help you create the configuration file and the directory
structure.
In mtldp.utils.converter
, there are functions for the three basic
types of data structure converting from their own data structure to the
other commonly used data structure.
In mtldp.utils.database
, there are functions to simplify the process
of writing the data to the database. There are also some functions for
creating the tables.
In mtldp.utils.data_io
you can load trajectory data from CSV files, you
can load traffic network from the pickle file or you can dump the SPaT
data to the pickle file.
In mtldp.utils.time
, you can find the conversion function between
different time formats.
mtldp.preproc
(optional)#
This module provides functions that process the raw data to the data used in the research application. There are three modules:
build_network
map_match
process_trajs
In mtldp.preproc.build_network
, there are some functions to parse
the OSM data and build the traffic network elements.
In mtldp.preproc.map_match
, there are some functions to map the
trajectory points to the traffic network. In other words, this procedure
will assign the movement to the trajectory points.
In mtldp.preproc.trajs
, there are some functions to filter the
trajectory and calculate the basic traffic index for each trajectory.