google-polyline
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/google-polyline package

1.0.3 • Public • Published

google-polyline

npm npm license npm downloads build status

Encodes and decodes Google's polyline format

Install via npm

$ npm install --save google-polyline

Usage

var polyline = require( 'google-polyline' )
polyline.encode([
  [ 38.5, -120.2 ],
  [ 40.7, -120.95 ],
  [ 43.252, -126.453 ]
])
 
> '_p~iF~ps|U_ulLnnqC_mqNvxq`@'
polyline.decode( '_p~iF~ps|U_ulLnnqC_mqNvxq`@' )
 
> [
  [ 38.5, -120.2 ],
  [ 40.7, -120.95 ],
  [ 43.252, -126.453 ]
]

Benchmarks

$ npm run benchmark
# decode: 3 points ⨉ 1000
ok ~9.03 ms (0 s + 9026482 ns)

# decode: ~350 points ⨉ 1000
ok ~34 ms (0 s + 33985497 ns)

# encode: 3 points ⨉ 1000
ok ~16 ms (0 s + 15696046 ns)

# encode: ~350 points ⨉ 1000
ok ~80 ms (0 s + 80340403 ns)

Package Sidebar

Install

npm i google-polyline

Weekly Downloads

9,446

Version

1.0.3

License

MIT

Unpacked Size

5.79 kB

Total Files

7

Last publish

Collaborators

  • jhermsmeier