routingkit

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: BSD-2-Clause Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxDistance uint32

MaxDistance represents the maximum possible route distance.

Functions

func ParseOSMSpeedToKM added in v0.1.2

func ParseOSMSpeedToKM(str string) (int, bool)

Types

type DistanceClient

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

func NewDistanceClient

func NewDistanceClient(mapFile string, profile Profile) (DistanceClient, error)

NewDistanceClient initializes a DistanceClient using the provided .osm.pbf file and .ch file. The .ch file will be created if it does not already exist. It is the caller's responsibility to call Delete on the client when it is no longer needed.

func (*DistanceClient) Delete

func (c *DistanceClient) Delete()

Delete deletes the client, releasing memory allocated for C++ routing data structures

func (DistanceClient) Distance

func (c DistanceClient) Distance(from []float32, to []float32) uint32

Distance returns the length of the shortest possible route between the points

func (DistanceClient) Distances

func (c DistanceClient) Distances(source []float32, targets [][]float32) []uint32

Distances returns a slice containing the minimum distances from the source to the points in targets.

func (DistanceClient) Matrix

func (c DistanceClient) Matrix(sources [][]float32, targets [][]float32) [][]uint32

Matrix creates a matrix representing the minimum distances from the points in sources to the points in targets.

func (DistanceClient) Nearest

func (c DistanceClient) Nearest(point []float32) ([]float32, bool)

Nearest returns the nearest point in the road network within the radius configured on the Client. The second argument will be false if no point could be found.

func (DistanceClient) Route

func (c DistanceClient) Route(from []float32, to []float32) (uint32, [][]float32)

Route finds the fastest route between the two points, returning the total route distance and the waypoints describing the route.

func (*DistanceClient) SetSnapRadius

func (c *DistanceClient) SetSnapRadius(n float32)

SetSnapRadius updates Client so that all queries will snap points to the nearest street network point within the given radius in meters.

type Profile added in v0.1.2

type Profile struct {
	Name             string
	TransportMode    TransportMode
	PreventLeftTurns bool
	PreventUTurns    bool
	Filter           TagMapFilter
	SpeedMapper      SpeedMapper
}

func Bike added in v0.1.2

func Bike() Profile

func Car added in v0.1.2

func Car() Profile

func NewProfile added in v0.1.2

func NewProfile(
	name string,
	transportMode TransportMode,
	preventLeftTurns bool,
	preventUTurns bool,
	filter TagMapFilter,
	speedMapper SpeedMapper,
) Profile

func Pedestrian added in v0.1.2

func Pedestrian() Profile

func Truck added in v0.1.2

func Truck(height, width, length, weight float64, speed int) Profile

type SpeedMapper added in v0.1.2

type SpeedMapper func(wayId int, tagMap map[string]string) int

type TagMapFilter added in v0.1.2

type TagMapFilter func(wayId int, tagMap map[string]string) bool

type TravelTimeClient

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

func NewTravelTimeClient

func NewTravelTimeClient(mapFile string, profile Profile) (TravelTimeClient, error)

NewTravelTimeClient initializes a TravelTimeClient using the provided .osm.pbf file and .ch file. The .ch file will be created if it does not already exist. It is the caller's responsibility to call Delete on the client when it is no longer needed.

func (TravelTimeClient) Matrix

func (c TravelTimeClient) Matrix(sources [][]float32, targets [][]float32) [][]uint32

Matrix creates a matrix representing the minimum travel times (by car) from the points in sources to the points in targets.

func (TravelTimeClient) Nearest

func (c TravelTimeClient) Nearest(point []float32) ([]float32, bool)

Nearest returns the nearest point in the road network within the radius configured on the Client. The second argument will be false if no point could be found.

func (TravelTimeClient) Route

func (c TravelTimeClient) Route(from []float32, to []float32) (uint32, [][]float32)

Route finds the fastest route between the two points, returning the total route travel time by car and the waypoints describing the route.

func (*TravelTimeClient) SetSnapRadius

func (c *TravelTimeClient) SetSnapRadius(n float32)

SetSnapRadius updates Client so that all queries will snap points to the nearest street network point within the given radius in meters.

func (TravelTimeClient) TravelTime

func (c TravelTimeClient) TravelTime(from []float32, to []float32) uint32

TravelTime returns the travel time by car for the shortest possible route between the points.

func (TravelTimeClient) TravelTimes

func (c TravelTimeClient) TravelTimes(source []float32, targets [][]float32) []uint32

TravelTimes returns a slice containing the minimum car travel times from the source to the points in targets.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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