Skip to content

Instantly share code, notes, and snippets.

@perrygeo
Last active October 21, 2015 21:02
Show Gist options
  • Save perrygeo/3684ca73e534601db0e7 to your computer and use it in GitHub Desktop.
Save perrygeo/3684ca73e534601db0e7 to your computer and use it in GitHub Desktop.
>>> # expected results based on mapbox/polyline
>>> results = '_p~iF~ps|U_ulLnnqC_mqNvxq`@'
>>> points = [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
>>>
>>> from polyline.codec import PolylineCodec
>>> codec = PolylineCodec()
>>> codec.encode(points)
u'_p~iF~ps|U_ulLnnqC_mqNvxq`@'
>>> codec.encode(points) == results
True
>>>
>>> import gpolyencode
>>> encoder = gpolyencode.GPolyEncoder()
>>> encoder.encode(points)['points']
'~ps|U_p~iFnnqC_ulLvxq`@_mqN'
>>> encoder.encode(points)['points'] == results
False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment