mirror of
https://github.com/mapbox/polyline.git
synced 2026-01-25 14:43:44 +00:00
polyline
A simple google-esque polyline
implementation in Javascript. Compatible with nodejs (npm install polyline and the browser (copy src/polyline.js)).
Encodes/decodes into lat/lng coordinate pairs. Use fromGeoJSON() to encode from GeoJSON objects.
Installation
npm install polyline
Example
var polyline = require('polyline');
// returns an array of lat, lon pairs you can pass to polyline.encode()
polyline.flip({
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [20.566406, 43.421008]
}
});
// returns an array of lat, lon pairs
polyline.decode('_p~iF~ps|U_ulLnnqC_mqNvxq`@');
// returns a string-encoded polyline
polyline.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]);
Documentation
See Also
Description
Languages
JavaScript
99.7%
Makefile
0.3%
