{ "info": { "author": "Rui Gil", "author_email": "ruipgil@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# TrackToTrip\n*TrackToTrip* is a library to process GPS tracks.\n\nThe main goals are to transform a (gpx) **track into a trip**.\n\n> **track**\n> raw representation of a GPS recording. It is not precise, has noise and valuable information is hidden.\n\n\n> **trip**\n> result of one or more processed tracks. Its start and end points have semantic meaning, such as home, work or school. It has less errors and it's compressed, with as little information loss as possible. In short, a trip is an approximation of the true path recorded.\n\n## Installing\n\nYou can install *TrackToTrip* with *[pip](https://pypi.python.org/pypi/tracktotrip)* or *EasyInstall*,\n\n```\npip install tracktotrip\n```\n\nor\n\n```\neasy_install install tracktotrip\n```\n\n**Python 2.x** is required, mainly because of the [ikalman](https://github.com/ruipgil/ikalman) package.\n\nYou may want to install the dependencies with *easyinstall* first, to avoid building libraries such as *numpy*.\n\n## Overview\n\nThe starting points are the [Track](../master/tracktotrip/track.py), [Segment](../master/tracktotrip/segment.py) and [Point](../master/tracktotrip/point.py) classes.\n\n### [Track](../master/tracktotrip/track.py)\n\nCan be loaded from a GPX file:\n\n````python\nfrom tracktotrip import Track, Segment, Point\n\ntrack = Track.from_gpx(open('file_to_track.gpx', 'r'))\n```\n\nA track can be transformed into a trip with the method ` to_trip `. Transforming a track into a trip executes the following steps:\n\n1. Smooths the segments, using the [kalman filter](../master/tracktotrip/smooth.py)\n\n2. Spatiotemporal segmentation for each segment, using the [DBSCAN algorithm](../master/tracktotrip/spatiotemporal_segmentation.py) to find spatiotemporal clusters\n\n3. Compresses every segment, using [spatiotemporal-aware compression algorithm](../master/tracktotrip/compression.py)\n\nA track is composed by ` Segment `s, and each segment by ` Point `s.\n\nIt can be saved to a GPX file:\n\n````python\nwith open('file.gpx', 'w') as f:\n f.write(track.to_gpx())\n```\n\n### [Segment](../master/tracktotrip/segment.py)\n\nA Segment holds the points, the transportation modes used, and the start and end semantic locations.\n\n### [Point](../master/tracktotrip/point.py)\n\nA Point holds the position and time. Currently the library doesn't support elevation.\n\n### Other modules\n\n+ [`tracktotrip.classifer.Classifier`](../master/tracktotrip/classifier.py) provides a wrapper around the [sklearn](http://scikit-learn.org/) classifiers.\n\n+ [`tracktotrip.compression`](../master/tracktotrip/compression.py) implements path compression algorithm, such as:\n - ` drp `: Douglas Ramer Peucker Algorithm\n - ` td_sp `: Top-Down Speed-Based Trajectory Compression Algorithm [1]\n - ` td_tr `: Top-Down Time-Ratio Trajectory Compression Algorithm [1]\n - ` spt `: A combination of both `td_sp` and `td_tr` [1]\n\n+ [`tracktotrip.kalman.kalman_filter`](../master/tracktotrip/kalman.py) executes the kalman filter in a list of point\n\n+ [`tracktotrip.learn_trip`](../master/tracktotrip/learn_trip.py) implements\n - ` trip_learn ` used learn trips\n - ` complete_trip ` used to find trips between two points\n\n+ [`tracktotrip.location.infer_location`](../master/tracktotrip/location.py) uses known locations, and web APIs such as Google's and Foursquare's.\n\n+ [`tracktotrip.similarity`](../master/tracktotrip/similarity.py) implements function to find similarity between two ` Segment `s\n\n+ [`tracktotrip.smooth`](../master/tracktotrip/smooth.py) implements functions mitigate kalman's lack of precision in the first predictions\n\n+ [`tracktotrip.spatiotemporal_segmentation.spatiotemporal_segmentation`](../master/tracktotrip/spatiotemporal_segmentation.py) uses the DBSCAN algorithm to perform spatiotemporal segmentation\n\n+ [`tracktotrip.transportation_mode`](../master/tracktotrip/transportation_mode.py) implements transportation learning and prediction functions, such as:\n - `extract_features_2` to extract features from a set of points\n - `learn_transportation_mode` to learn the transportation modes of a track\n - `speed_clustering` implements changepoint segmentation and classifies sub-segments between changepoints\n\n*TrackToTrip* is flexible, with lots of parameters. For general parameters, refer to [` processmysteps.default_config `](https://github.com/ruipgil/ProcessMySteps/blob/master/processmysteps/default_config.py)\n\n[1]: Spatiotemporal Compression Techniques for Moving Point Objects, Nirvana Meratnia and Rolf A. de By, 2004, in Advances in Database Technology - EDBT 2004: 9th International Conference on Extending Database Technology, Heraklion, Crete, Greece, March 14-18, 2004\n\n## Transportation mode classification\n\nFor transportation mode classification, TrackToTrip uses a wrapper around sklearn's classifiers. We consider two different classifiers: the [Stochastic Gradient Descent Classifier](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html#sklearn.linear_model.SGDClassifier), and [CART Decision Tree Classifier](http://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html#sklearn.tree.DecisionTreeClassifier), both implemented by [sklearn](http://scikit-learn.org/).\n\nTo classify a segment (trip) we first do changepoint segmentation, which sub-divides a segment into points where there was a change in mean the absolute velocity difference.\nFor each sub-segment we then extract features.\n\nFeature extraction is based on cumulative speed, and the amount of time spent at them. We create a [histogram](../master/docs/histogram.pdf), where the bins the velocity (rounded) and the bin values are the percentage of time spent at a certain velocity (bin 10 is 10km/h). Then we create a [cumulative histogram](../master/docs/cum_histograms.pdf), and extract the velocities where the cumulative value surpasses 10, 20 to 90% of the time.\n\nFor instance, for a sub-division marked as *walk*, we get the features:\n\n```\n[0, 0, 1, 1, 2, 2, 2, 3, 3]\n```\n\nThis means that 90% (index 8) of the velocity is 3km/h, and 50% (index 4) of the sub-division was spent below 2km/h.\n\nTo train the default classifier we used the [GeoLife GPS Trajectories](https://www.microsoft.com/en-us/download/details.aspx?id=52367) dataset. We provide command line scripts to download the dataset and transform it to GPX.\n\nWe used the labels: *foot*, *airplane*, *train* and (motor) *vehicle*. The foot label includes data marked as *run* and *walk*. The train label is composed of data marked as *train* and *subway*. And the *vehicle* label is the combination of *taxi*, *bus*, *motorcycle* and *car* samples. We compressed the possible labels because of two factors:\n + Lack of relevant data. Only 4 samples were marked as *run*;\n + Transportation modes that belong to the same category. *Taxi*, *car* and *bus* are similar transportation modes, with a similar feature set.\nWe also don't use tracks marked as *boat* and *bike*. Because there's only seven *boat* samples, and because *bike* features are reduce the quality of classification and is rarely used by us.\n\nTo evaluate the classifiers we perform [two-fold validation](../master/scripts/two_fold_validation.py) with a 50% split of the data.\n\nUsing a SGD Classifier obtain a score between 84% and 86% (we use random permutation during training). Using a decision tree we obtain a score of 83%. These values drop to around 70% using the *bike* labels.\n\n[The ` classification_validation.txt ` file offers more details](../master/docs/classifier_validation.txt).\n\n## Command line tools\n\nIn addition to the library, *TrackToTrip* offers three command line tools outside of the library to manipulate GPS tracks and to generate classifier.\n\n### tracktotrip_utils\n\n```\nusage: tracktotrip_utils.py [-h] [-a] [-s] [-o] [--eps EPS]\n [--mintime MINTIME] [--seed SEED]\n track [track ...] output_folder\n\nManipulate tracks\n\npositional arguments:\n track track to process, must be a gpx file\n output_folder\n\noptional arguments:\n -h, --help show this help message and exit\n -a, --anonymize anonymizes tracks, by doing random rotations and\n translations\n -s, --split splits tracks so that each file contains a segment\n -o, --organize takes all tracks and split them, naming them according\n with their start date\n --eps EPS max distance to other points. Used when spliting.\n Defaults to 1.0\n --mintime MINTIME minimum time required to split, in seconds. Defaults to\n 120\n --seed SEED random number generator seed. Used when anonymizing\n```\n\n### tracktotrip_geolife_dataset\n\n```\nusage: tracktotrip_geolife_dataset.py [-h] [-o outputFolder] [-d]\n datasetFolder\n\nGeoLife Trajectory dataset transportation mode extractor. Extracts\ntransportation mode from the dataset, into individual files, annotated with\nthe following format: [transporation mode].[control].[nPoints].[original file\nname].gpx\n\npositional arguments:\n datasetFolder Path to the GeoLife dataset folder\n\noptional arguments:\n -h, --help show this help message and exit\n -o outputFolder, --output outputFolder\n Path to processed dataset\n -d, --download Pass this flag to download the GeoLife dataset to the\n specified folder and to process it\n\n```\n### tracktotrip_build_classifier\n\n```\nusage: tracktotrip_build_classifier.py [-h] [-o outputFolder] [-f features]\n [-l labels]\n datasetFolder\n\npositional arguments:\n datasetFolder Path to the dataset, such as the GeoLife dataset\n\noptional arguments:\n -h, --help show this help message and exit\n -o outputFolder, --output outputFolder\n Folder to store the classifier\n -f features, --features features\n Path to features file to use\n -l labels, --labels labels\n Path to features file to use\n\n```\n\n## Parallel projects\n\n[*GatherMySteps*](https://github.com/ruipgil/GatherMySteps) is a webapp, that doubles as a track editor and semantic annotator. It is supported by [*ProcessMySteps*](https://github.com/ruipgil/ProcessMySteps), a python backend application that uses *TrackToTrip*.\n\n[*GPXplorer*](http://ruipgil.com/GatherMySteps) is the track editor-only fork of [*GatherMySteps*](https://github.com/ruipgil/GatherMySteps)\n\nThese three projects are part of my master thesis.\n\n## Contributing\n\n1. Fork\n2. Make changes\n3. Create test cases\n4. Lint with *pylint*\n5. Send PR\n\nThis project also follows the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html).\n\n## License\n\n[MIT license](../master/LICENSE)\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/ruipgil/TrackToTrip/releases/tag/0.4.6", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ruipgil/TrackToTrip", "keywords": "track,trip,GPS,GPX", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "tracktotrip", "package_url": "https://pypi.org/project/tracktotrip/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tracktotrip/", "project_urls": { "Download": "https://github.com/ruipgil/TrackToTrip/releases/tag/0.4.6", "Homepage": "https://github.com/ruipgil/TrackToTrip" }, "release_url": "https://pypi.org/project/tracktotrip/0.4.6/", "requires_dist": null, "requires_python": null, "summary": "Track processing library", "version": "0.4.6" }, "last_serial": 2479846, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "19bb2308f8e6d3c8d13eea13e37bbd3b", "sha256": "b0c1b9a9fc5e2bfbab36a1dde99ec8e8cdbead923c3889a8e07effba0cef2fc7" }, "downloads": -1, "filename": "tracktotrip-0.1.tar.gz", "has_sig": false, "md5_digest": "19bb2308f8e6d3c8d13eea13e37bbd3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18175, "upload_time": "2016-06-22T00:13:20", "url": "https://files.pythonhosted.org/packages/5e/df/7a321028c62cfb028d020701481b9117fb3f850779995b03ea72cbf2b2a6/tracktotrip-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3b9b5d02fe1c551acbe88341ac9b1142", "sha256": "55d36ef4b5445575e8f692fe625ed94fee45e291aacfbc52bfb2a33d75f14466" }, "downloads": -1, "filename": "tracktotrip-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3b9b5d02fe1c551acbe88341ac9b1142", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18182, "upload_time": "2016-06-22T00:32:28", "url": "https://files.pythonhosted.org/packages/b9/d3/39853b1d62618193aa310ee0b79cd760e68fe976ff4eea5298eacf608c07/tracktotrip-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "95a0872c783c504483a57c739a2c29f0", "sha256": "b19f6c19c28e4583539e261e9cc3cf550eda3d8681c479e51f6235f9baf89a39" }, "downloads": -1, "filename": "tracktotrip-0.1.2.tar.gz", "has_sig": false, "md5_digest": "95a0872c783c504483a57c739a2c29f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18243, "upload_time": "2016-06-22T00:55:53", "url": "https://files.pythonhosted.org/packages/44/f8/34adbc58b1ff2a6c393c1a5d04f4371bc8a627a876ec0d20dbcba4d8ccd0/tracktotrip-0.1.2.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "eb4d611a1c8dc55f0278842a7e00e422", "sha256": "bea2cf3ea8d575e6037fbe73f2804c014587369bc0e74f9d3636a768ac45bb37" }, "downloads": -1, "filename": "tracktotrip-0.1.4.tar.gz", "has_sig": false, "md5_digest": "eb4d611a1c8dc55f0278842a7e00e422", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18257, "upload_time": "2016-06-22T01:21:03", "url": "https://files.pythonhosted.org/packages/ef/f4/1197bb52c274e90325eb07467538a39b24f958207b467fee839222a40d5c/tracktotrip-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "477c84154a02c9d8d8286a49017c95cf", "sha256": "2f6c084264498b929a44924dfeb388498158eb43cedcae79848c0425873136ad" }, "downloads": -1, "filename": "tracktotrip-0.1.5.tar.gz", "has_sig": false, "md5_digest": "477c84154a02c9d8d8286a49017c95cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18296, "upload_time": "2016-06-22T01:27:51", "url": "https://files.pythonhosted.org/packages/15/f0/58999c21136160a0d61e4636d15f45f4cc2be397abc73fdf482af1fe3fa2/tracktotrip-0.1.5.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "1e2ba37a230a98509c176ea2d47ea37e", "sha256": "76ba636be4c0dae54030c169560999d7700aafefa49f774a532f966641b52bf9" }, "downloads": -1, "filename": "tracktotrip-0.2.tar.gz", "has_sig": false, "md5_digest": "1e2ba37a230a98509c176ea2d47ea37e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18251, "upload_time": "2016-07-22T06:44:12", "url": "https://files.pythonhosted.org/packages/5a/1a/078f2afb1418af4c5a40fc341361a37db4e3bd0633e877edcd50b4f23b20/tracktotrip-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "4facfdfc572b1748d5e0b1b80597013d", "sha256": "a32e8ea2edea13b5a0ec86db879bac5cc3855d39a8772139026e6f8692d11ce8" }, "downloads": -1, "filename": "tracktotrip-0.3.tar.gz", "has_sig": false, "md5_digest": "4facfdfc572b1748d5e0b1b80597013d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1405404, "upload_time": "2016-07-28T15:59:05", "url": "https://files.pythonhosted.org/packages/0c/b3/f035336cc83dea32c0dc4d624525a68eacb13a2aba5e423521920b0528de/tracktotrip-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "67f522d8a7e8e4dbd52105c001dfab4d", "sha256": "17e31977d1d95a16fb7037badec42612c3ab5814354f1b59a4e7232a6a987f2f" }, "downloads": -1, "filename": "tracktotrip-0.3.1.tar.gz", "has_sig": false, "md5_digest": "67f522d8a7e8e4dbd52105c001dfab4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1405763, "upload_time": "2016-07-31T23:14:55", "url": "https://files.pythonhosted.org/packages/75/9a/a8b9ae345d289ae688b712f43290c7ea8668d0f2d8c3af45b7243d1364f1/tracktotrip-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "6ce967efbf9ed62735d2f36c2284f4b6", "sha256": "587bb6fa525146199a79e4d57bce4a4c3a78a1b4b007471c6e0459bfe84478fc" }, "downloads": -1, "filename": "tracktotrip-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6ce967efbf9ed62735d2f36c2284f4b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1405835, "upload_time": "2016-07-31T23:27:58", "url": "https://files.pythonhosted.org/packages/b8/0c/52b3efd41f004e75f94e30628b14e514ed702ed92b4ca1851a593d2f09d6/tracktotrip-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "d161021097bf38f6bdd784f8f2ec95c2", "sha256": "6fb55fadfb5e28590b5e0bf63fa7a3e061e3a127b555d833c02837cde3344aa3" }, "downloads": -1, "filename": "tracktotrip-0.3.3.tar.gz", "has_sig": false, "md5_digest": "d161021097bf38f6bdd784f8f2ec95c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1405887, "upload_time": "2016-08-01T15:52:29", "url": "https://files.pythonhosted.org/packages/f4/74/20fcbc036b961feef26fae78dedfe89ae4d4984b921d2534b9b1d7b28b2f/tracktotrip-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "6459b699f7fed44038c4f60675cf1067", "sha256": "9ae0b2d821b4d0c8178eb03166d8f938b3732ac65f4cd784eb9796a5f6aa9aa6" }, "downloads": -1, "filename": "tracktotrip-0.3.4.tar.gz", "has_sig": false, "md5_digest": "6459b699f7fed44038c4f60675cf1067", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1406319, "upload_time": "2016-08-06T13:47:12", "url": "https://files.pythonhosted.org/packages/f3/63/2170b4642a8e9558bde48b582effd36c9daabeef048ad16f1722b46a1773/tracktotrip-0.3.4.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "20ab91cd681582ebed912c30f0493a6c", "sha256": "11ba3821d3a8efb0565d45a04f9aeaeddcf509d2e059cd3c9b0c4399dce036a5" }, "downloads": -1, "filename": "tracktotrip-0.4.3.tar.gz", "has_sig": false, "md5_digest": "20ab91cd681582ebed912c30f0493a6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44993, "upload_time": "2016-09-05T22:11:27", "url": "https://files.pythonhosted.org/packages/2a/b3/64cfc10a93ced8913bb202feeeb11dd08559efb27ed7079b07e200a0563a/tracktotrip-0.4.3.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "600e6083fdd1c0c19ae379f171393364", "sha256": "d6326bd44954eab4e2c73415e20eea4cb7fe0e6a700a2dca1b940827395ceff5" }, "downloads": -1, "filename": "tracktotrip-0.4.5.tar.gz", "has_sig": false, "md5_digest": "600e6083fdd1c0c19ae379f171393364", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44988, "upload_time": "2016-09-05T22:22:57", "url": "https://files.pythonhosted.org/packages/91/1b/1074c0c1b77492ce79cee7ff4182820d66bb0ffc470ea3c69323775e1307/tracktotrip-0.4.5.tar.gz" } ], "0.4.6": [ { "comment_text": "", "digests": { "md5": "973e080253f8efc6851eb2c8c8fcd3fd", "sha256": "4ed79ff74572c0967a9043b24584db9353360fc7dab0eee8a6d43b057ed6d5bc" }, "downloads": -1, "filename": "tracktotrip-0.4.6.tar.gz", "has_sig": false, "md5_digest": "973e080253f8efc6851eb2c8c8fcd3fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47349, "upload_time": "2016-11-23T22:27:41", "url": "https://files.pythonhosted.org/packages/4f/48/2eaf27548114940b12926a1649000d30e360f0eb34ca87fdf925ada1aefa/tracktotrip-0.4.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "973e080253f8efc6851eb2c8c8fcd3fd", "sha256": "4ed79ff74572c0967a9043b24584db9353360fc7dab0eee8a6d43b057ed6d5bc" }, "downloads": -1, "filename": "tracktotrip-0.4.6.tar.gz", "has_sig": false, "md5_digest": "973e080253f8efc6851eb2c8c8fcd3fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47349, "upload_time": "2016-11-23T22:27:41", "url": "https://files.pythonhosted.org/packages/4f/48/2eaf27548114940b12926a1649000d30e360f0eb34ca87fdf925ada1aefa/tracktotrip-0.4.6.tar.gz" } ] }