xy

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance2d

func Distance2d(a, b [2]float64) float64

Distance2d returns the cartesian distance

func DistanceHaversine

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

DistanceHaversine .

func DistanceHaversinePoint

func DistanceHaversinePoint(a, b []float64) float64

DistanceHaversinePoint .

func InterpolateStopTimes

func InterpolateStopTimes(stoptimes []tl.StopTime) ([]tl.StopTime, error)

InterpolateStopTimes sets missing ArrivalTime, DestinationTime values. StopTimes must be sorted and valid.

func Length2d

func Length2d(line [][2]float64) float64

Length2d returns the cartesian length of line

func LengthHaversine

func LengthHaversine(line [][2]float64) float64

LengthHaversine returns the Haversine approximate length of a line.

func LineClosestPoint

func LineClosestPoint(line [][2]float64, point [2]float64) ([2]float64, float64)

LineClosestPoint returns the point (and position) on line closest to point. Based on go-geom DistanceFromPointToLineString

func LinePositions

func LinePositions(line [][2]float64, points [][2]float64) []float64

LinePositions finds the relative position of the closest point along the line for each point.

func LinePositionsFallback

func LinePositionsFallback(line [][2]float64) []float64

LinePositionsFallback returns the relative position along the line for each point.

func SegmentClosestPoint

func SegmentClosestPoint(a, b, p [2]float64) ([2]float64, float64)

SegmentClosestPoint returns the point (and position) on AB closest to P.

Types

type GeomCache

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

GeomCache helps speed up StopTime interpolating by caching various results

func NewGeomCache

func NewGeomCache() *GeomCache

NewGeomCache returns an initialized geomCache

func (*GeomCache) AddShape

func (g *GeomCache) AddShape(eid string, shape tl.Shape)

AddShape adds a Shape to the geometry cache.

func (*GeomCache) AddSimplifiedShape added in v0.8.1

func (g *GeomCache) AddSimplifiedShape(eid string, shape tl.Shape, threshold float64)

AddSimplifiedShape adds a simplified Shape to the geometry cache.

func (*GeomCache) AddStop

func (g *GeomCache) AddStop(eid string, stop tl.Stop)

AddStop adds a Stop to the geometry cache.

func (*GeomCache) GetShape

func (g *GeomCache) GetShape(eid string) [][2]float64

GetShape returns the coordinates for the cached shape.

func (*GeomCache) GetStop

func (g *GeomCache) GetStop(eid string) [2]float64

GetStop returns the coordinates for the cached stop.

func (*GeomCache) InterpolateStopTimes

func (g *GeomCache) InterpolateStopTimes(trip tl.Trip) ([]tl.StopTime, error)

InterpolateStopTimes uses the cached geometries to interpolate StopTimes.

func (*GeomCache) MakeShape

func (g *GeomCache) MakeShape(stopids ...string) (tl.Shape, error)

MakeShape returns geometry for the given stops.

Jump to

Keyboard shortcuts

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