flexpolyline

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const FormatVersion uint = 1

FlexPolyline specification version

Variables

This section is empty.

Functions

func Encode

func Encode(polyline *Polyline) (string, error)

Encodes a Polyline to a string following the format specified in https://github.com/heremaps/flexible-polyline/blob/master/README.md

Types

type Point

type Point struct {
	Lat      float64
	Lng      float64
	ThirdDim float64
}

A point on the Earth surface with an optional third dimension

type Polyline

type Polyline struct {
	// contains filtered or unexported fields
}

Structure to store FlexPolyline

func CreatePolyline

func CreatePolyline(precision Precision, points []Point) (*Polyline, error)

Creates a two dimensional FlexPolyline

func CreatePolyline3D

func CreatePolyline3D(type3D Type3D, precision2D, precision3D Precision, points []Point) (*Polyline, error)

Creates a three dimensional FlexPolyline

func Decode

func Decode(polyline string) (*Polyline, error)

Decodes a Polyline from a string following the format specified in https://github.com/heremaps/flexible-polyline/blob/master/README.md

func MustCreatePolyline

func MustCreatePolyline(precision Precision, points []Point) *Polyline

Creates a two dimensional FlexPolyline. Panics if arguments are bad.

func MustCreatePolyline3D

func MustCreatePolyline3D(type3D Type3D, precision2D, precision3D Precision, points []Point) *Polyline

Creates a three dimensional FlexPolyline. Panics if arguments are bad.

func (*Polyline) Coordinates

func (p *Polyline) Coordinates() []Point

func (*Polyline) Encode

func (p *Polyline) Encode() (string, error)

Encodes a Polyline to a string

func (*Polyline) Precision2D

func (p *Polyline) Precision2D() Precision

func (*Polyline) Precision3D

func (p *Polyline) Precision3D() Precision

func (*Polyline) Type3D

func (p *Polyline) Type3D() Type3D

type Precision

type Precision uint8

Number of decimal digits after the comma

type Type3D

type Type3D uint8

Whether the third dimension is present and what meaning it has

const (
	Absent Type3D = iota
	Level
	Altitude
	Elevation
	Reserved1
	Reserved2
	Custom1
	Custom2
)

func GetThirdDimension

func GetThirdDimension(polyline string) (Type3D, error)

Returns the type of the third dimension data, parsing only the header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL