Skip to content
Google Maps polyline encoding for Go
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Ignore coverage.out Oct 11, 2016
.golangci.yml
.travis.yml Add coverage badge Mar 24, 2019
LICENSE Add LICENSE Apr 27, 2014
README.md Add coverage badge Mar 24, 2019
go.mod Migrate to github.com/stretchr/testify Aug 10, 2019
go.sum Migrate to github.com/stretchr/testify Aug 10, 2019
polyline.go Fix problems identified by golangci-lint Aug 10, 2019
polyline_test.go Migrate to github.com/stretchr/testify Aug 10, 2019

README.md

go-polyline

Build Status GoDoc Report Card Coverage Status

Package polyline implements a Google Maps Encoding Polyline encoder and decoder.

Encoding example

func ExampleEncodeCoords() {
    var coords = [][]float64{
        {38.5, -120.2},
        {40.7, -120.95},
        {43.252, -126.453},
    }
    fmt.Printf("%s\n", EncodeCoords(coords))
    // Output: _p~iF~ps|U_ulLnnqC_mqNvxq`@
}

Decoding example

func ExampleDecodeCoords() {
    buf := []byte("_p~iF~ps|U_ulLnnqC_mqNvxq`@")
    coords, _, _ := DecodeCoords(buf)
    fmt.Printf("%v\n", coords)
    // Output: [[38.5 -120.2] [40.7 -120.95] [43.252 -126.453]]
}

License

BSD-2-Clause

You can’t perform that action at this time.