https://github.com/yhozen/rn-maps-polyline
A tiny library to use polyline in react-native-maps
https://github.com/yhozen/rn-maps-polyline
api gmaps gmaps-api js polyline react-native react-native-maps
Last synced: 8 months ago
JSON representation
A tiny library to use polyline in react-native-maps
- Host: GitHub
- URL: https://github.com/yhozen/rn-maps-polyline
- Owner: Yhozen
- License: mit
- Created: 2017-02-17T20:57:26.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-20T18:30:04.000Z (almost 9 years ago)
- Last Synced: 2025-04-07T22:07:52.345Z (9 months ago)
- Topics: api, gmaps, gmaps-api, js, polyline, react-native, react-native-maps
- Language: JavaScript
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rn-maps-polyline
[](https://npmjs.com/package/rn-maps-polyline)
[](https://npmjs.com/package/rn-maps-polyline)
[](https://npmjs.com/package/rn-maps-polyline)
A tiny library to use polyline in react-native-maps (MapView.Polyline), based in [google-polyline](https://www.npmjs.com/package/google-polyline)
## v2.0.0
Now decoding is almost 3x times faster than before
## Install via [npm](https://npmjs.com)
```sh
$ npm install --save rn-maps-polyline
```
## Usage
```js
import RNPolyline from 'rn-maps-polyline'
//or
import { decode, encode } from 'rn-maps-polyline'
```
or
```js
var RNPolyline = require('rn-maps-polyline')
```
```js
RNPolyline.encode([
{ latitude: 37.772, longitude: -122.214 },
{ latitude: 21.291, longitude: -157.821 },
{ latitude: -18.142, longitude: 178.431 },
{ latitude: -27.467, longitude: 153.027 }
])
> '_jpeFn||hVf}qcBvnixEfwtoF_fic_Afh|w@~u`zC'
```
```js
RNPolyline.decode('_jpeFn||hVf}qcBvnixEfwtoF_fic_Afh|w@~u`zC')
> [
{ latitude: 37.772, longitude: -122.214 },
{ latitude: 21.291, longitude: -157.821 },
{ latitude: -18.142, longitude: 178.431 },
{ latitude: -27.467, longitude: 153.027 }
]
```
## Contribute
The project is using babel and uglifyjs to compile so make sure you have both if you want to clone the repo