Trajectory I/O¶
trajectory_io ¶
Reading and writing of trajectories (trajectopy ASCII format). For KML, see :mod:trajectopy.io.kml.
read_trajectory ¶
read_trajectory(filename: str) -> Trajectory
Reads a trajectory from a trajectopy ASCII file.
Parameters:
-
filename(str) –Path to the file.
Returns:
-
Trajectory(Trajectory) –The loaded trajectory.
Source code in trajectopy\io\trajectory_io.py
read_trajectory_string ¶
read_trajectory_string(content: str) -> Trajectory
Reads a trajectory from the string content of a trajectopy ASCII file.
Parameters:
-
content(str) –File content including the header.
Returns:
-
Trajectory(Trajectory) –The loaded trajectory.
Source code in trajectopy\io\trajectory_io.py
trajectory_to_string ¶
trajectory_to_string(trajectory: Trajectory) -> str
Serializes a trajectory to a CSV-formatted string with metadata headers.
Headers included: #epsg, #name, #nframe, #sorting, #fields.
Source code in trajectopy\io\trajectory_io.py
write_trajectory ¶
write_trajectory(
trajectory: Trajectory, filename: str, mode: str = "w"
) -> None
Writes a trajectory to a trajectopy ASCII file.
Parameters:
-
trajectory(Trajectory) –Trajectory to write.
-
filename(str) –The output file path.
-
mode(str, default:'w') –File open mode. Defaults to "w".