Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/twpayne/go-polyline
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.
https://github.com/twpayne/go-polyline
decoding encoding geospatial gis go golang google-maps polyline
Last synced: 3 days ago
JSON representation
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.
- Host: GitHub
- URL: https://github.com/twpayne/go-polyline
- Owner: twpayne
- License: bsd-2-clause
- Created: 2014-04-27T18:32:05.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-12-27T15:44:14.000Z (about 1 month ago)
- Last Synced: 2025-01-30T12:07:25.908Z (10 days ago)
- Topics: decoding, encoding, geospatial, gis, go, golang, google-maps, polyline
- Language: Go
- Homepage:
- Size: 65.4 KB
- Stars: 111
- Watchers: 6
- Forks: 30
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-polyline
[![Build Status](https://github.com/twpayne/go-polyline/workflows/Test/badge.svg)](https://github.com/twpayne/go-polyline/actions?query=workflow%3ATest)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/twpayne/go-polyline)](https://pkg.go.dev/github.com/twpayne/go-polyline)
[![Coverage Status](https://coveralls.io/repos/github/twpayne/go-polyline/badge.svg)](https://coveralls.io/github/twpayne/go-polyline)Package `polyline` implements a Google Maps Encoding Polyline encoder and decoder.
## Encoding example
```go
func ExampleEncodeCoords() {
coords := [][]float64{
{38.5, -120.2},
{40.7, -120.95},
{43.252, -126.453},
}
fmt.Println(string(polyline.EncodeCoords(coords)))
// Output: _p~iF~ps|U_ulLnnqC_mqNvxq`@
}
```## Decoding example
```go
func ExampleDecodeCoords() {
buf := []byte("_p~iF~ps|U_ulLnnqC_mqNvxq`@")
coords, _, _ := polyline.DecodeCoords(buf)
fmt.Println(coords)
// Output: [[38.5 -120.2] [40.7 -120.95] [43.252 -126.453]]
}
```## License
BSD-2-Clause