2015-06-19 16:45:15 -07:00
2015-05-30 16:56:35 -07:00
2015-05-30 16:54:41 -07:00
2015-05-30 16:54:33 -07:00
2015-02-27 12:24:56 -08:00
2015-06-19 16:45:15 -07:00
2012-07-19 13:06:11 -04:00
2012-07-19 13:06:11 -04:00
2012-07-26 15:16:21 -04:00
2015-05-30 16:56:25 -07:00
2015-06-19 16:45:15 -07:00

Build Status

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
polyline encoding and decoding in javascript
Readme BSD-3-Clause 901 KiB
Languages
JavaScript 99.7%
Makefile 0.3%