initial commit
This commit is contained in:
17
encoding/polylines/encoding.go
Normal file
17
encoding/polylines/encoding.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package polylines
|
||||
|
||||
import (
|
||||
"github.com/paulmach/orb"
|
||||
"github.com/twpayne/go-polyline"
|
||||
)
|
||||
|
||||
func Encode(line orb.LineString) string {
|
||||
|
||||
preparedLine := [][]float64{}
|
||||
|
||||
for _, point := range line {
|
||||
preparedLine = append(preparedLine, []float64{point.Lon(), point.Lat()})
|
||||
}
|
||||
|
||||
return string(polyline.EncodeCoords(preparedLine))
|
||||
}
|
||||
Reference in New Issue
Block a user