Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marchdev-tk/google_polyline_algorithm
Dart implementation of Googles Polyline Encoding lossy compression Algorithm.
https://github.com/marchdev-tk/google_polyline_algorithm
dart dart-library dart-package dart2 dartlang google-maps polyline polyline-algorithm polyline-decoder polyline-encoder
Last synced: 3 months ago
JSON representation
Dart implementation of Googles Polyline Encoding lossy compression Algorithm.
- Host: GitHub
- URL: https://github.com/marchdev-tk/google_polyline_algorithm
- Owner: marchdev-tk
- License: bsd-3-clause
- Created: 2020-02-28T21:54:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-21T14:44:20.000Z (almost 3 years ago)
- Last Synced: 2024-09-29T16:05:20.946Z (4 months ago)
- Topics: dart, dart-library, dart-package, dart2, dartlang, google-maps, polyline, polyline-algorithm, polyline-decoder, polyline-encoder
- Language: Dart
- Homepage:
- Size: 24.4 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# google_polyline_algorithm
![Build](https://github.com/marchdev-tk/google_polyline_algorithm/workflows/build/badge.svg)
[![codecov](https://codecov.io/gh/marchdev-tk/google_polyline_algorithm/branch/master/graph/badge.svg)](https://codecov.io/gh/marchdev-tk/google_polyline_algorithm)
[![Pub](https://img.shields.io/pub/v/google_polyline_algorithm.svg)](https://pub.dartlang.org/packages/google_polyline_algorithm)
![GitHub](https://img.shields.io/github/license/marchdev-tk/google_polyline_algorithm)
![GitHub stars](https://img.shields.io/github/stars/marchdev-tk/google_polyline_algorithm?style=social)Dart implementation of Googles Polyline Encoding lossy compression Algorithm.
## Getting Started
This package adds following methods to work with Googles Polyline Encoding Algorithm:
* `encodePoint(num current, {num previous = 0, int accuracyExponent = 5})` encodes a single coordinate
* `encodePolyline(List> coordinates, {int accuracyExponent = 5})` encodes a list of coordinates into an encoded polyline stirng
* `decodePolyline(String polyline, {int accuracyExponent = 5})` decodes an encoded polyline string into a list of coordinates
## Examples
```dart
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';final coord = encodePoint(-179.9832104);
print(coord);
// output is `~oia@'final coords = encodePolyline([
[38.5, -120.2],
[40.7, -120.95],
[43.252, -126.453],
]);
print(coords);
// output is `_p~iF~ps|U_ulLnnqC_mqNvxq`@'final polyline = decodePolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@');
print(polyline);
// output is [[38.5, -120.2],[40.7, -120.95],[43.252, -126.453],]
```