Skip to content

Instantly share code, notes, and snippets.

@arjunattam
Created September 1, 2016 06:15
Show Gist options
  • Save arjunattam/a1253d0c1feecb46f59081bbaa3e25de to your computer and use it in GitHub Desktop.
Save arjunattam/a1253d0c1feecb46f59081bbaa3e25de to your computer and use it in GitHub Desktop.
Time aware polyline example
# A location is [latitude, longitude]
locations = [
[19.13626, 72.92506],
[19.13597, 72.92495],
[19.13553, 72.92469],
]
# With Google's encoded polyline algorithm, locations are encoded as
google_polyline = 'spxsBsdb|Lx@TvAr@'
# A point is [latitude, longitude, time]
points = [
[19.13626, 72.92506, '2016-07-21T05:43:09+00:00'],
[19.13597, 72.92495, '2016-07-21T05:43:15+00:00'],
[19.13553, 72.92469, '2016-07-21T05:43:21+00:00'],
]
# With HyperTrack's encoded polyline algorithm, points are encoded as
time_aware_polyline = 'spxsBsdb|Lymo`qvAx@TKvAr@K'
# To use the python library, just call the encode method
from time_aware_polyline import encode_time_aware_polyline
time_aware_polyline = encode_time_aware_polyline(points)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment