gpx

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMaxSpeed

func CalcMaxSpeed(speedsDistances []SpeedsAndDistances) float64

CalcMaxSpeed returns the maximum speed

func CalcUphillDownhill

func CalcUphillDownhill(elevations []NullableFloat64) (float64, float64)

CalcUphillDownhill calculates uphill and downhill from given elevations

func Distance2D

func Distance2D(lat1, lon1, lat2, lon2 float64, haversine bool) float64

Distance2D calculates the distance of 2 geo coordinates

func Distance3D

func Distance3D(lat1, lon1 float64, ele1 NullableFloat64, lat2, lon2 float64, ele2 NullableFloat64, haversine bool) float64

Distance3D calculates the distance of 2 geo coordinates including elevation distance

func ElevationAngle

func ElevationAngle(loc1, loc2 Point, radians bool) float64

ElevationAngle calculates the elevation angle (steepness) between to points

func GetGpxElementInfo

func GetGpxElementInfo(prefix string, gpxDoc GPXElementInfo) string

GetGpxElementInfo pretty prints some basic information about this GPX elements

func HaversineDistance

func HaversineDistance(lat1, lon1, lat2, lon2 float64) float64

HaversineDistance returns the haversine distance between two points.

Implemented from http://www.movable-type.co.uk/scripts/latlong.html

func Length2D

func Length2D(locs []Point) float64

Length2D calculates the lenght of given points list disregarding elevation

func Length3D

func Length3D(locs []Point) float64

Length3D calculates the lenght of given points list including elevation distance

func ToRad

func ToRad(x float64) float64

ToRad converts to radial coordinates

func ToXml

func ToXml(g *GPX, params ToXmlParams) ([]byte, error)

ToXml returns the xml representation of the GPX object. Params are optional, you can set null to use GPXs Version and no indentation.

Types

type ElevationBounds

type ElevationBounds struct {
	MinElevation float64
	MaxElevation float64
}

ElevationBounds contains max/min elevation

func (ElevationBounds) Equals

func (b ElevationBounds) Equals(b2 ElevationBounds) bool

Equals returns true if two Bounds objects are equal

func (*ElevationBounds) String

func (b *ElevationBounds) String() string

String implements Stringer interface

type GPX

type GPX struct {
	XMLNs        string
	XmlNsXsi     string
	XmlSchemaLoc string

	Version          string
	Creator          string
	Name             string
	Description      string
	AuthorName       string
	AuthorEmail      string
	AuthorLink       string
	AuthorLinkText   string
	AuthorLinkType   string
	Copyright        string
	CopyrightYear    string
	CopyrightLicense string
	Link             string
	LinkText         string
	LinkType         string
	Time             *time.Time
	Keywords         string

	// TODO
	//Extensions []byte
	Waypoints []GPXPoint
	Routes    []GPXRoute
	Tracks    []GPXTrack
}

GPX implements one or multiple GPS tracks that can be written to and parsed from a gpx file

func ParseBytes

func ParseBytes(buf []byte) (*GPX, error)

ParseBytes parses GPX from bytes

func ParseFile

func ParseFile(fileName string) (*GPX, error)

ParseFile parses a gpx file and returns a GPX object

func ParseString

func ParseString(str string) (*GPX, error)

ParseString parses GPX from string

func (*GPX) AddElevation

func (g *GPX) AddElevation(elevation float64)

AddElevation adds elevation on all points (pointElevation = pointElevation + elevation)

func (*GPX) AddMissingTime

func (g *GPX) AddMissingTime()

AddMissingTime adds missing times

func (*GPX) AppendPoint

func (g *GPX) AppendPoint(p *GPXPoint)

AppendPoint appends a point to the end of the last segment of the last track. If no track or segment exists empty ones will be added.

func (*GPX) AppendRoute

func (g *GPX) AppendRoute(r *GPXRoute)

AppendRoute adds a route

func (*GPX) AppendSegment

func (g *GPX) AppendSegment(s *GPXTrackSegment)

AppendSegment appends a segment on the end of the last track. If the track does not exist an empty one will be created and added.

func (*GPX) AppendTrack

func (g *GPX) AppendTrack(t *GPXTrack)

AppendTrack adds given track

func (*GPX) AppendWaypoint

func (g *GPX) AppendWaypoint(w *GPXPoint)

AppendWaypoint adds a waypoint

func (*GPX) Bounds

func (g *GPX) Bounds() GpxBounds

Bounds returns the bounds of all tracks in a Gpx.

func (*GPX) Duration

func (g *GPX) Duration() float64

Duration returns the duration of all tracks in a Gpx in seconds.

func (*GPX) ElevationBounds

func (g *GPX) ElevationBounds() ElevationBounds

ElevationBounds returns the min and max elevation of all tracks

func (*GPX) ExecuteOnAllPoints

func (g *GPX) ExecuteOnAllPoints(executor func(*GPXPoint))

ExecuteOnAllPoints executes given function on all points

func (*GPX) ExecuteOnRoutePoints

func (g *GPX) ExecuteOnRoutePoints(executor func(*GPXPoint))

ExecuteOnRoutePoints executes given function on route points

func (*GPX) ExecuteOnTrackPoints

func (g *GPX) ExecuteOnTrackPoints(executor func(*GPXPoint))

ExecuteOnTrackPoints executes given function on track points

func (*GPX) ExecuteOnWaypoints

func (g *GPX) ExecuteOnWaypoints(executor func(*GPXPoint))

ExecuteOnWaypoints executes given function on waypoints

func (*GPX) GetGpxInfo

func (g *GPX) GetGpxInfo() string

GetGpxInfo pretty prints some basic information about this GPX, its track and segments

func (*GPX) GetLocationPositionsOnTrack

func (g *GPX) GetLocationPositionsOnTrack(samples int, location Location) []float64

GetLocationPositionsOnTrack gets position of a single point on the track. TODO: remove following restriction by implementing a caching option Always use GetLocationsPositionsOnTrack(...) for multiple points, it is faster.

func (*GPX) GetLocationsPositionsOnTrack

func (g *GPX) GetLocationsPositionsOnTrack(samples int, locations ...Location) [][]float64

GetLocationsPositionsOnTrack finds locations candidates where this location is on a track. Returns an array of distances from start for every given location. Used (for example) for positioning waypoints on the graph. The bigger the samples number the more granular the search will be. For example if samples is 100 then (cca) every 100th point will be searched. This is for tracks with thousands of waypoints -- computing distances for each and every point is slow.

func (*GPX) GetTrackPointsNo

func (g *GPX) GetTrackPointsNo() int

GetTrackPointsNo returns the amount of track points of all tracks

func (*GPX) HasTimes

func (g *GPX) HasTimes() bool

HasTimes Checks if *tracks* and segments have time information. Routes and Waypoints are ignored.

func (*GPX) Length2D

func (g *GPX) Length2D() float64

Length2D returns the 2D length of all tracks in a Gpx.

func (*GPX) Length3D

func (g *GPX) Length3D() float64

Length3D returns the 3D length of all tracks,

func (*GPX) MovingData

func (g *GPX) MovingData() MovingData

MovingData returns the moving data for all tracks in a Gpx.

func (*GPX) PositionAt

func (g *GPX) PositionAt(t time.Time) []TrackPosition

PositionAt returns a LocationResultsPair consisting the segment index and the GpxWpt at a certain time.

func (*GPX) ReduceGpxToSingleTrack

func (g *GPX) ReduceGpxToSingleTrack()

ReduceGpxToSingleTrack combines all tracks to a single track

func (*GPX) ReduceTrackPoints

func (g *GPX) ReduceTrackPoints(maxPointsNo int, minDistanceBetween float64)

ReduceTrackPoints reduces the number of track points of all tracks

func (*GPX) RemoveElevation

func (g *GPX) RemoveElevation()

RemoveElevation removes elevation info on all points

func (*GPX) RemoveEmpty

func (g *GPX) RemoveEmpty()

RemoveEmpty removes all a) segments without points and b) tracks without segments

func (*GPX) RemoveHorizontalExtremes

func (g *GPX) RemoveHorizontalExtremes()

RemoveHorizontalExtremes removes horizontal extremes

func (*GPX) RemoveVerticalExtremes

func (g *GPX) RemoveVerticalExtremes()

RemoveVerticalExtremes removes vertical extremes

func (*GPX) SimplifyTracks

func (g *GPX) SimplifyTracks(maxDistance float64)

SimplifyTracks does Ramer-Douglas-Peucker algorithm for simplification of polyline on all tracks

func (*GPX) SmoothHorizontal

func (g *GPX) SmoothHorizontal()

SmoothHorizontal smoothes all tracks horizontally

func (*GPX) SmoothVertical

func (g *GPX) SmoothVertical()

SmoothVertical smoothes all tracks vertically

func (*GPX) Split

func (g *GPX) Split(trackNo, segNo, pointNo int)

Split splits the Gpx segment segNo in a given track trackNo at pointNo.

func (*GPX) StoppedPositions

func (g *GPX) StoppedPositions() []TrackPosition

StoppedPositions returns the positions where there was a stop

func (*GPX) TimeBounds

func (g *GPX) TimeBounds() TimeBounds

TimeBounds returns the time bounds of all tacks in a Gpx.

func (*GPX) ToXml

func (g *GPX) ToXml(params ToXmlParams) ([]byte, error)

ToXml converts the object to xml. Params are optional, you can set null to use GPXs Version and no indentation.

func (*GPX) UphillDownhill

func (g *GPX) UphillDownhill() UphillDownhill

UphillDownhill returns uphill and downhill values for all tracks in a Gpx.

type GPXElementInfo

type GPXElementInfo interface {
	Length2D() float64
	Length3D() float64
	Bounds() GpxBounds
	MovingData() MovingData
	UphillDownhill() UphillDownhill
	TimeBounds() TimeBounds
	GetTrackPointsNo() int
}

GPXElementInfo implements some basic stats all common GPX elements (GPX, track and segment) must have

type GPXPoint

type GPXPoint struct {
	Point
	// TODO
	Timestamp time.Time
	// TODO: Type
	MagneticVariation string
	// TODO: Type
	GeoidHeight string
	// Description info
	Name        string
	Comment     string
	Description string
	Source      string
	// TODO
	// Links       []GpxLink
	Symbol string
	Type   string
	// Accuracy info
	TypeOfGpsFix       string
	Satellites         NullableInt
	HorizontalDilution NullableFloat64
	VerticalDilution   NullableFloat64
	PositionalDilution NullableFloat64
	AgeOfDGpsData      NullableFloat64
	DGpsId             NullableInt
}

GPXPoint represents a point of the gpx file

func (*GPXPoint) MaxDilutionOfPrecision

func (pt *GPXPoint) MaxDilutionOfPrecision() float64

MaxDilutionOfPrecision returns the dilution precision of a GpxWpt.

func (*GPXPoint) SpeedBetween

func (pt *GPXPoint) SpeedBetween(pt2 *GPXPoint, threeD bool) float64

SpeedBetween calculates the speed between two GpxWpts.

func (*GPXPoint) TimeDiff

func (pt *GPXPoint) TimeDiff(pt2 *GPXPoint) float64

TimeDiff returns the time difference of two GpxWpts in seconds.

type GPXRoute

type GPXRoute struct {
	Name        string
	Comment     string
	Description string
	Source      string
	// TODO
	//Links       []Link
	Number NullableInt
	Type   string
	// TODO
	Points []GPXPoint
}

GPXRoute implements a gpx route

func (*GPXRoute) Center

func (rte *GPXRoute) Center() (float64, float64)

Center returns the center of a GPX route.

func (*GPXRoute) ExecuteOnPoints

func (rte *GPXRoute) ExecuteOnPoints(executor func(*GPXPoint))

ExecuteOnPoints executes given function on all points of the route

func (*GPXRoute) Length

func (rte *GPXRoute) Length() float64

Length returns the length of a GPX route.

type GPXTrack

type GPXTrack struct {
	Name        string
	Comment     string
	Description string
	Source      string
	// TODO
	//Links    []Link
	Number   NullableInt
	Type     string
	Segments []GPXTrackSegment
}

GPXTrack implements a gpx track

func (*GPXTrack) AddElevation

func (trk *GPXTrack) AddElevation(elevation float64)

AddElevation adds elevation on all points of the track (pointElevation = pointElevation + elevation)

func (*GPXTrack) AddMissingTime

func (trk *GPXTrack) AddMissingTime()

AddMissingTime adds missing times

func (*GPXTrack) AppendSegment

func (trk *GPXTrack) AppendSegment(s *GPXTrackSegment)

AppendSegment adds a segment to the track

func (*GPXTrack) Bounds

func (trk *GPXTrack) Bounds() GpxBounds

Bounds returns the bounds of a GPX track.

func (*GPXTrack) Duration

func (trk *GPXTrack) Duration() float64

Duration returns the duration of a GPX track.

func (*GPXTrack) ElevationBounds

func (trk *GPXTrack) ElevationBounds() ElevationBounds

ElevationBounds returns the elevation bouds of the track

func (*GPXTrack) ExecuteOnPoints

func (trk *GPXTrack) ExecuteOnPoints(executor func(*GPXPoint))

ExecuteOnPoints executes given function on track points

func (*GPXTrack) GetTrackPointsNo

func (trk *GPXTrack) GetTrackPointsNo() int

GetTrackPointsNo returns the amount of points on the track

func (*GPXTrack) HasTimes

func (trk *GPXTrack) HasTimes() bool

HasTimes checks if the track has times

func (*GPXTrack) Join

func (trk *GPXTrack) Join(segNo, segNo2 int)

Join joins two GPX segments in a GPX track.

func (*GPXTrack) JoinNext

func (trk *GPXTrack) JoinNext(segNo int)

JoinNext joins a GPX segment with the next segment in the current GPX track.

func (*GPXTrack) Length2D

func (trk *GPXTrack) Length2D() float64

Length2D returns the 2D length of a GPX track.

func (*GPXTrack) Length3D

func (trk *GPXTrack) Length3D() float64

Length3D returns the 3D length of a GPX track.

func (*GPXTrack) MovingData

func (trk *GPXTrack) MovingData() MovingData

MovingData returns the moving data of a GPX track.

func (*GPXTrack) PositionAt

func (trk *GPXTrack) PositionAt(t time.Time) []TrackPosition

PositionAt returns a LocationResultsPair for a given time.

func (*GPXTrack) ReduceTrackPoints

func (trk *GPXTrack) ReduceTrackPoints(minDistance float64)

ReduceTrackPoints reduces the number of points on the track

func (*GPXTrack) RemoveHorizontalExtremes

func (trk *GPXTrack) RemoveHorizontalExtremes()

RemoveHorizontalExtremes removes horizontal extremes

func (*GPXTrack) RemoveVerticalExtremes

func (trk *GPXTrack) RemoveVerticalExtremes()

RemoveVerticalExtremes removes vertical extremes

func (*GPXTrack) SimplifyTracks

func (trk *GPXTrack) SimplifyTracks(maxDistance float64)

SimplifyTracks does Ramer-Douglas-Peucker algorithm for simplification of polyline

func (*GPXTrack) SmoothHorizontal

func (trk *GPXTrack) SmoothHorizontal()

SmoothHorizontal smoothes the track horizontally

func (*GPXTrack) SmoothVertical

func (trk *GPXTrack) SmoothVertical()

SmoothVertical smoothes the track vertically

func (*GPXTrack) Split

func (trk *GPXTrack) Split(segNo, ptNo int)

Split splits a GPX segment at a point number ptNo in a GPX track.

func (*GPXTrack) StoppedPositions

func (trk *GPXTrack) StoppedPositions() []TrackPosition

StoppedPositions returns the positions where there was a stop

func (*GPXTrack) TimeBounds

func (trk *GPXTrack) TimeBounds() TimeBounds

TimeBounds returns the time bounds of a GPX track.

func (*GPXTrack) UphillDownhill

func (trk *GPXTrack) UphillDownhill() UphillDownhill

UphillDownhill return the uphill and downhill values of a GPX track.

type GPXTrackSegment

type GPXTrackSegment struct {
	Points []GPXPoint
}

GPXTrackSegment represents a segment of a track

func (*GPXTrackSegment) AddElevation

func (seg *GPXTrackSegment) AddElevation(elevation float64)

AddElevation adds elevation on segment points (pointElevation = pointElevation + elevation)

func (*GPXTrackSegment) AddMissingTime

func (seg *GPXTrackSegment) AddMissingTime()

AddMissingTime adds missing times in the segment

func (*GPXTrackSegment) AppendPoint

func (seg *GPXTrackSegment) AppendPoint(p *GPXPoint)

AppendPoint adds a point to the segment

func (*GPXTrackSegment) Bounds

func (seg *GPXTrackSegment) Bounds() GpxBounds

Bounds returns the bounds of a GPX segment.

func (*GPXTrackSegment) Duration

func (seg *GPXTrackSegment) Duration() float64

Duration returns the duration in seconds in a GPX segment.

func (*GPXTrackSegment) ElevationBounds

func (seg *GPXTrackSegment) ElevationBounds() ElevationBounds

ElevationBounds returns the min and max elevation of the segment

func (*GPXTrackSegment) Elevations

func (seg *GPXTrackSegment) Elevations() []NullableFloat64

Elevations returns a slice with the elevations in a GPX segment.

func (*GPXTrackSegment) ExecuteOnPoints

func (seg *GPXTrackSegment) ExecuteOnPoints(executor func(*GPXPoint))

ExecuteOnPoints executes given function on segment points

func (*GPXTrackSegment) GetTrackPointsNo

func (seg *GPXTrackSegment) GetTrackPointsNo() int

GetTrackPointsNo returns the amount of points of the segment

func (*GPXTrackSegment) HasTimes

func (seg *GPXTrackSegment) HasTimes() bool

HasTimes checks if there are times WARNING: currently not implemented!

func (*GPXTrackSegment) Join

func (seg *GPXTrackSegment) Join(seg2 *GPXTrackSegment)

Join concatenates to GPX segments.

func (*GPXTrackSegment) Length2D

func (seg *GPXTrackSegment) Length2D() float64

Length2D returns the 2D length of a GPX segment.

func (*GPXTrackSegment) Length3D

func (seg *GPXTrackSegment) Length3D() float64

Length3D returns the 3D length of a GPX segment.

func (*GPXTrackSegment) MovingData

func (seg *GPXTrackSegment) MovingData() MovingData

MovingData returns the moving data of a GPX segment.

func (*GPXTrackSegment) PositionAt

func (seg *GPXTrackSegment) PositionAt(t time.Time) int

PositionAt returns the GpxWpt at a given time.

func (*GPXTrackSegment) ReduceTrackPoints

func (seg *GPXTrackSegment) ReduceTrackPoints(minDistance float64)

ReduceTrackPoints reduces the number of track points of the segment

func (*GPXTrackSegment) RemoveHorizontalExtremes

func (seg *GPXTrackSegment) RemoveHorizontalExtremes()

RemoveHorizontalExtremes removes horizontal extremes from the segment

func (*GPXTrackSegment) RemoveVerticalExtremes

func (seg *GPXTrackSegment) RemoveVerticalExtremes()

RemoveVerticalExtremes removes vertical extremes from the segment

func (*GPXTrackSegment) SimplifyTracks

func (seg *GPXTrackSegment) SimplifyTracks(maxDistance float64)

SimplifyTracks does Ramer-Douglas-Peucker algorithm for simplification of polyline

func (*GPXTrackSegment) SmoothHorizontal

func (seg *GPXTrackSegment) SmoothHorizontal()

SmoothHorizontal smoothes the segment horizontally

func (*GPXTrackSegment) SmoothVertical

func (seg *GPXTrackSegment) SmoothVertical()

SmoothVertical smoothes the segment vertically

func (*GPXTrackSegment) Speed

func (seg *GPXTrackSegment) Speed(pointIdx int) float64

Speed returns the speed at point number in a GPX segment.

func (*GPXTrackSegment) Split

func (seg *GPXTrackSegment) Split(pt int) (*GPXTrackSegment, *GPXTrackSegment)

Split splits a GPX segment at point index pt. Point pt remains in first part.

func (*GPXTrackSegment) StoppedPositions

func (seg *GPXTrackSegment) StoppedPositions() []TrackPosition

StoppedPositions returns the positions where there was a stop

func (*GPXTrackSegment) TimeBounds

func (seg *GPXTrackSegment) TimeBounds() TimeBounds

TimeBounds returns the time bounds of a GPX segment.

func (*GPXTrackSegment) UphillDownhill

func (seg *GPXTrackSegment) UphillDownhill() UphillDownhill

UphillDownhill returns uphill and dowhill in a GPX segment.

type GpxBounds

type GpxBounds struct {
	MinLatitude  float64
	MaxLatitude  float64
	MinLongitude float64
	MaxLongitude float64
}

GpxBounds contains min/max latitude and longitude

func (GpxBounds) Equals

func (b GpxBounds) Equals(b2 GpxBounds) bool

Equals returns true if two Bounds objects are equal

func (*GpxBounds) String

func (b *GpxBounds) String() string

String implements Stringer interface

type Location

type Location interface {
	GetLatitude() float64
	GetLongitude() float64
	GetElevation() NullableFloat64
}

Location implements an interface for all kinds of lat/long/elevation information

type MovingData

type MovingData struct {
	MovingTime      float64
	StoppedTime     float64
	MovingDistance  float64
	StoppedDistance float64
	MaxSpeed        float64
}

MovingData contains moving data

func (MovingData) Equals

func (md MovingData) Equals(md2 MovingData) bool

Equals compares to another MovingData struct

type NullableFloat64

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

NullableFloat64 implements a nullable float64

func NewNullableFloat64

func NewNullableFloat64(data float64) *NullableFloat64

NewNullableFloat64 creates a new NullableFloat64

func (NullableFloat64) MarshalXML

func (n NullableFloat64) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements xml marshalling

func (NullableFloat64) MarshalXMLAttr

func (n NullableFloat64) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr implements xml attribute marshalling

func (*NullableFloat64) NotNull

func (n *NullableFloat64) NotNull() bool

NotNull checks if value is not null

func (*NullableFloat64) Null

func (n *NullableFloat64) Null() bool

Null checks if value is null

func (*NullableFloat64) SetNull

func (n *NullableFloat64) SetNull()

SetNull sets the value to null

func (*NullableFloat64) SetValue

func (n *NullableFloat64) SetValue(data float64)

SetValue sets the value

func (*NullableFloat64) UnmarshalXML

func (n *NullableFloat64) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements xml unmarshalling

func (*NullableFloat64) UnmarshalXMLAttr

func (n *NullableFloat64) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr implements xml attribute unmarshalling

func (*NullableFloat64) Value

func (n *NullableFloat64) Value() float64

Value returns the value

type NullableInt

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

NullableInt implements a nullable int

func NewNullableInt

func NewNullableInt(data int) *NullableInt

NewNullableInt creates a new NullableInt

func (NullableInt) MarshalXML

func (n NullableInt) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements xml marshalling

func (NullableInt) MarshalXMLAttr

func (n NullableInt) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr implements xml attribute marshalling

func (*NullableInt) NotNull

func (n *NullableInt) NotNull() bool

NotNull checks if value is not null

func (*NullableInt) Null

func (n *NullableInt) Null() bool

Null checks if value is null

func (*NullableInt) SetNull

func (n *NullableInt) SetNull()

SetNull sets the value to null

func (*NullableInt) SetValue

func (n *NullableInt) SetValue(data int)

SetValue sets the value

func (*NullableInt) UnmarshalXML

func (n *NullableInt) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements xml unmarshalling

func (*NullableInt) UnmarshalXMLAttr

func (n *NullableInt) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr implements xml attribute unmarshalling

func (*NullableInt) Value

func (n *NullableInt) Value() int

Value returns the value

type NullableString

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

NullableString implements a nullable string

func NewNullableString

func NewNullableString(data string) *NullableString

NewNullableString creates a new NullableString

func (*NullableString) NotNull

func (n *NullableString) NotNull() bool

NotNull checks if value is not null

func (*NullableString) Null

func (n *NullableString) Null() bool

Null checks if value is null

func (*NullableString) SetNull

func (n *NullableString) SetNull()

SetNull sets the value to null

func (*NullableString) SetValue

func (n *NullableString) SetValue(data string)

SetValue sets the value

func (*NullableString) Value

func (n *NullableString) Value() string

Value returns the value

type NullableTime

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

NullableTime implements a nullable time

func NewNullableTime

func NewNullableTime(data time.Time) *NullableTime

NewNullableTime creates a new NullableTime

func (*NullableTime) NotNull

func (n *NullableTime) NotNull() bool

NotNull checks if value is not null

func (*NullableTime) Null

func (n *NullableTime) Null() bool

Null checks if value is null

func (*NullableTime) SetNull

func (n *NullableTime) SetNull()

SetNull sets the value to null

func (*NullableTime) SetValue

func (n *NullableTime) SetValue(data time.Time)

SetValue sets the value

func (*NullableTime) Value

func (n *NullableTime) Value() time.Time

Value returns the value

type Point

type Point struct {
	Latitude  float64
	Longitude float64
	Elevation NullableFloat64
}

Point represents generic point data and implements the Location interface

func (*Point) Distance2D

func (pt *Point) Distance2D(pt2 Location) float64

Distance2D returns the 2D distance of two GpxWpts.

func (*Point) Distance3D

func (pt *Point) Distance3D(pt2 Location) float64

Distance3D returns the 3D distance of two GpxWpts.

func (*Point) GetElevation

func (pt *Point) GetElevation() NullableFloat64

GetElevation returns the elevation

func (*Point) GetLatitude

func (pt *Point) GetLatitude() float64

GetLatitude returns the latitude

func (*Point) GetLongitude

func (pt *Point) GetLongitude() float64

GetLongitude returns the longititude

type SpeedsAndDistances

type SpeedsAndDistances struct {
	Speed    float64
	Distance float64
}

SpeedsAndDistances contaings speed/distance information

type TimeBounds

type TimeBounds struct {
	StartTime time.Time
	EndTime   time.Time
}

TimeBounds contains min/max time

func (TimeBounds) Equals

func (tb TimeBounds) Equals(tb2 TimeBounds) bool

Equals compares to another TimeBounds struct

func (*TimeBounds) String

func (tb *TimeBounds) String() string

String implements Stringer interface

type ToXmlParams

type ToXmlParams struct {
	Version string
	Indent  bool
}

ToXmlParams contains settings for xml transformation

type TrackPosition

type TrackPosition struct {
	Point
	TrackNo   int
	SegmentNo int
	PointNo   int
}

TrackPosition implements the position of a point on the track

type UphillDownhill

type UphillDownhill struct {
	Uphill   float64
	Downhill float64
}

UphillDownhill contains uphill/downhill information

func (UphillDownhill) Equals

func (ud UphillDownhill) Equals(ud2 UphillDownhill) bool

Equals compares to another UphillDownhill struct

Jump to

Keyboard shortcuts

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