xy

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance2d

func Distance2d(a, b Point) 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 []Point) float64

Length2d returns the cartesian length of line

func LengthHaversine

func LengthHaversine(line []Point) float64

LengthHaversine returns the Haversine approximate length of a line.

func LinePositions

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

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

func LinePositionsFallback

func LinePositionsFallback(line []Point) []float64

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

func PointSliceContains added in v0.11.0

func PointSliceContains(a []Point, b []Point) bool

func PointSliceEqual added in v0.11.0

func PointSliceEqual(a []Point, b []Point) bool

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) 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) []Point

GetShape returns the coordinates for the cached shape.

func (*GeomCache) GetStop

func (g *GeomCache) GetStop(eid string) Point

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.

type Point added in v0.8.8

type Point struct {
	Lon float64
	Lat float64
}

func LineClosestPoint

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

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

func SegmentClosestPoint

func SegmentClosestPoint(a, b, p Point) (Point, float64)

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

Jump to

Keyboard shortcuts

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