mapbox / mapbox-match.js

A plugin to align geometries to streetmap data
Other
34 stars 6 forks source link

Consider using polylines #5

Closed freenerd closed 9 years ago

freenerd commented 9 years ago

Polylines will be faster to transfer, since they are way smaller. You can request them via ?geometry=polyline.

planemad commented 9 years ago

@freenerd Requests to

https://api-directions-johan-matching.tilestream.net/matching/v4/mapbox.driving.json?access_token=pk.eyJ1IjoicGxhbmVtYWQiLCJhIjoiemdYSVVLRSJ9.g3lbg_eN0kztmsfIPxa9MQ?geometry=polyline

Gives me a 401: {"message":"Invalid Access Token"}

freenerd commented 9 years ago

&geometry

planemad commented 9 years ago

@freenerd :+1:

planemad commented 9 years ago

@freenerd sample polyline response

{"geometry":"m~keiAjlj|qCkI@iAAqB@eE@yAAqOBeH@eL@gWFqB?mFOc@BqDAaDIyCA}ACuC@{MAqH@wJ@aL@qKB_K@eHAo@@sBAuD@cA?oI?uJ?eK?cK?oK?qK?oNFoC?iD@kECsLD{FBmJ?{J?]A?aa@qSRkDD@wQ"}

Which seems invalid according to https://developers.google.com/maps/documentation/utilities/polylineutility

Decoding using mapbox-polyline I get http://pastebin.com/sSEvRw08

Everything works ok without the polyline request

aaronlidman commented 9 years ago

@planemad Try polyline.decode(polyline, 6)

By default, out polyline lib is not compatible with google's format. Precision is 5, instead of google's 6.

planemad commented 9 years ago

Thanks @aaronlidman this one was quite a :ferris_wheel: