0.1.2 • Published 10 years ago
osrm-geojson v0.1.2
osrm-geojson
A node module for decoding OSRM shapes and returning GeoJSON geometry, built to map the results of Mapzen's Valhalla routing engine, but adaptible to anything using Project OSRM.
API
osrmDecode(encodedObject, precision)encodedObjectis the raw shape returned by the routing API. e.g. "egyc`A~qau~EzA?vg@?fT??~h@jAndCus@NG{k@"precisionis an integer (6 is a good benchmark)
Example
var osrmDecode = require("osrm-geojson");
var encoded = 'egyc`A~qau~EzA?vg@?fT??~h@jAndCus@NG{k@';
console.log(osrmDecode(encoded, 6));
// Result: '{"type":"LineString","coordinates":[[-117.27799999999999,34.157699],[-117.27799999999999,34.157652999999996],[-117.27799999999999,34.157001],[-117.27799999999999,34.156661],[-117.278672,34.156661],[-117.279702,34.156639]]}'