Plotting trajectories over time on Google Earth with Python
This python script transform one or several temporal trajectories composed of a set of nodes and links into a KML file plotting these trajectories over time on Google Earth. More specifically, the script takes as input two csv files with column names, the value separator is a semicolon ";".
-
Nodes.csv is composed of 3 columns providing geographical information abbout the nodes:
- Node ID
- Longitude of the node
- Latitude of the node
-
Links.csv is composed of 5 columns providing information about the "temporal" link between nodes defined in Nodes.csv. The links should be sorted by starting time.
- Link ID (numeric)
- Node of origin
- Node of destination
- Departure time of the link from the node of origin (date format '2014-01-01T08:00:00Z')
- Arrival time of the link to the node of destination
-
The script has also 7 parameters to set the kml movie's time windows, the nodes' and links' visibility (remaining time on screen), the nodes' and links' styles and the name of the output file. Their values can be set directly into the Python script kmlMovie.py.
- begin: Starting time of the movie (date format '2014-01-01T08:00:00Z')
- end: Ending time of the movie (date format '2014-01-01T08:00:00Z')
- delay_node: Number of seconds the nodes remain visible after their creation
- delay_link: Number of seconds the links remain visible after their creation
- hrefnodestyle: Hyperlink leading to the node style file
- rgbcolorlink: Define the links color with an rgb code
- output_file: Name of the output file
The code is not very complicated and you can test it directly to plot three temporal trajectories in Madrid. If you want more details about this script feel free to visit this post.
Enjoy!
If you need help, find a bug, want to give me advice or feedback, please contact me! You can reach me at maxime.lenormand[at]irstea.fr