# Export track or track collection
et TrackWriter pour stocker les données dans un fichier.
As usual, let’s start by defining our environment#
The first task is only useful for the online notebook and import the local tracklib code source. It’s not necessary if tracklib is installed from PyPI.
[1]:
import os
import sys
# Import de tracklib
module_path = os.path.abspath(os.path.join('../../../../..'))
if module_path not in sys.path:
sys.path.append(module_path)
# Import tracklib library
import tracklib as tkl
The following two imports are necessary for the tutorial:
[2]:
import os
To export only the basics attributes of a track, position and timestamp#
[3]:
csvpath = os.path.join(resource_path, 'data/test/test_write_csv_minim.wkt')
tkl.TrackWriter.writeToFile(track, csvpath, id_E=0,id_N=1,id_U=2,id_T=3,h=1, separator=";")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[3], line 1
----> 1 csvpath = os.path.join(resource_path, 'data/test/test_write_csv_minim.wkt')
2 tkl.TrackWriter.writeToFile(track, csvpath, id_E=0,id_N=1,id_U=2,id_T=3,h=1, separator=";")
NameError: name 'resource_path' is not defined
To export basic attributes and analytical features#
[4]:
csvpath = os.path.join(self.resource_path, 'data/test/test_write_csv_2AF.wkt')
af_names = ['speed', 'abs_curv']
TrackWriter.writeToFile(track, csvpath, id_E=0, id_N=1, id_U=2, id_T=3, h=1,
separator=";", af_names=af_names)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[4], line 1
----> 1 csvpath = os.path.join(self.resource_path, 'data/test/test_write_csv_2AF.wkt')
2 af_names = ['speed', 'abs_curv']
3 TrackWriter.writeToFile(track, csvpath, id_E=0, id_N=1, id_U=2, id_T=3, h=1,
4 separator=";", af_names=af_names)
NameError: name 'self' is not defined
Write one or many tracks in one or many GPX files#
[5]:
TrackWriter.writeToGpx(self.collection, path=gpxpath, af=True, oneFile=False)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[5], line 1
----> 1 TrackWriter.writeToGpx(self.collection, path=gpxpath, af=True, oneFile=False)
NameError: name 'TrackWriter' is not defined
Write in a KML#
[6]:
kmlpath = os.path.join(self.resource_path, 'data/test/couplage.kml')
TrackWriter.writeToKml(trace, path=kmlpath, type="LINE", af='speed')
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[6], line 1
----> 1 kmlpath = os.path.join(self.resource_path, 'data/test/couplage.kml')
2 TrackWriter.writeToKml(trace, path=kmlpath, type="LINE", af='speed')
NameError: name 'self' is not defined
[ ]: