# @here/flexpolyline

> Flexible Polyline encoding: a lossy compressed representation of a list of coordinate pairs or triples

Latest version **0.1.0** (published 2024-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @here/flexpolyline
pnpm add @here/flexpolyline
yarn add @here/flexpolyline
bun add @here/flexpolyline
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2024-03-20 |
| First published | 2024-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 116 |
| Author | HERE Europe B.V. |
| Maintainers | here-bot, here-maps, heremaps |
| Keywords | polyline, encoding |

## Links

- npm: https://www.npmjs.com/package/@here/flexpolyline
- Repository: https://github.com/heremaps/flexible-polyline
- Homepage: https://github.com/heremaps/flexible-polyline#readme
- Issues: https://github.com/heremaps/flexible-polyline/issues
- npm.io page: https://npm.io/package/@here/flexpolyline

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2024-03-20

## README

# Flexible Polyline encoding

The flexible polyline encoding is a lossy compressed representation of a list of coordinate pairs or
coordinate triples.

For a detailed description, please visit [GitHub](https://github.com/heremaps/flexible-polyline/).

## Sample usage

To encode a polyline:

```js
import { encode } from '@here/flexpolyline';

// Define an array of coordinates
const coordinates = [
    [50.1022829, 8.6982122],
    [50.1020076, 8.6956695],
    [50.1006313, 8.6914960],
    [50.0987800, 8.6875156]
];

// encode the polyline
const flexPolyline = encode({ polyline: coordinates });

// The output should be the flex polyline "BFoz5xJ67i1B1B7PzIhaxL7Y"
console.log(flexPolyline);
```

To decode a polyline:

```js
import { decode } from '@here/flexpolyline';

// Use "decode" to get back the coordinates from the sample above
const decoded = decode(flexPolyline);
console.log(decoded.polyline);
```

## License

Copyright (C) 2024 HERE Europe B.V.

See the [LICENSE](https://github.com/heremaps/flexible-polyline/blob/master/LICENSE) file in the root of this project for license details.

---
_Source: https://npm.io/package/@here/flexpolyline · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
