gpx

package
v0.0.0-...-8888066 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GPX

type GPX struct {
	XMLName xml.Name `xml:"gpx"`
	Creator string   `xml:"creator,attr"`
	Version string   `xml:"version,attr"`
	Tracks  []Track  `xml:"trk"`
}

GPX is the root element of a GPS Exchange Format File.

func UnmarshalGPX

func UnmarshalGPX(r io.ReadCloser) (*GPX, error)

UnmarshalGPX reads and parses the GPX data from the provided io.ReadCloser. It returns a pointer to the parsed GPX struct and any error encountered during parsing.

func (*GPX) Points

func (g *GPX) Points() []LatLng

Points returns all the points of all the segments in the tracks of this GPX.

type LatLng

type LatLng struct {
	Latitude  float64 `xml:"lat,attr"`
	Longitude float64 `xml:"lon,attr"`
}

LatLng is a single point within a segment.

func (LatLng) Distance

func (a LatLng) Distance(b LatLng) float64

type Segment

type Segment struct {
	Points []LatLng `xml:"trkpt"`
}

Segment is a segment of a Track, containing one or many TrackPoints.

type Track

type Track struct {
	Name     string    `xml:"name"`
	Type     string    `xml:"type"`
	Segments []Segment `xml:"trkseg"`
}

Track is a track in a GPX file, containing one or many segments.

Jump to

Keyboard shortcuts

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