Documentation ¶
Index ¶
- Variables
- func BikeSpeedMapper(_ int, tags map[string]string) int
- func BikeTagMapFilter(_ int, tags map[string]string) bool
- func CarSpeedMapper(_ int, tags map[string]string) int
- func CarTagMapFilter(id int, tags map[string]string) bool
- func ParseOSMSpeedToKM(str string) (float64, bool)
- func PedestrianSpeedMapper(_ int, tags map[string]string) int
- func PedestrianTagMapFilter(id int, tags map[string]string) bool
- func ShrinkToHullRect(pbfFile io.ReadSeeker, tagMapFilter TagMapFilter, points [][]float32, ...) ([][]float64, error)
- type DistanceClient
- func (c *DistanceClient) Delete()
- func (c DistanceClient) Distance(from []float32, to []float32) uint32
- func (c DistanceClient) Distances(source []float32, targets [][]float32) []uint32
- func (c DistanceClient) Matrix(sources [][]float32, targets [][]float32) [][]uint32
- func (c DistanceClient) Nearest(point []float32) ([]float32, bool)
- func (c DistanceClient) Route(from []float32, to []float32) (uint32, [][]float32)
- func (c *DistanceClient) SetSnapRadius(n float32)
- type Profile
- type SpeedMapper
- type TagMapFilter
- type TransportMode
- type TravelTimeClient
- func (c TravelTimeClient) Matrix(sources [][]float32, targets [][]float32) [][]uint32
- func (c TravelTimeClient) Nearest(point []float32) ([]float32, bool)
- func (c TravelTimeClient) Route(from []float32, to []float32) (uint32, [][]float32)
- func (c *TravelTimeClient) SetSnapRadius(n float32)
- func (c TravelTimeClient) TravelTime(from []float32, to []float32) uint32
- func (c TravelTimeClient) TravelTimes(source []float32, targets [][]float32) []uint32
Constants ¶
This section is empty.
Variables ¶
var Keep bool = keep.Keep
Keep C++ dependencies by referencing a file from their directory
var MaxDistance uint32
MaxDistance represents the maximum possible route distance.
Functions ¶
func BikeSpeedMapper ¶ added in v0.1.5
BikeSpeedMapper sets the speed for bikes according to the map tag
func BikeTagMapFilter ¶ added in v0.1.5
BikeTagMapFilter filters the map for map tags usable by bikes
func CarSpeedMapper ¶ added in v0.1.5
CarSpeedMapper sets the speed for cars according to allowed speed, map tag and surface
func CarTagMapFilter ¶ added in v0.1.5
CarTagMapFilter filters the map for map tags usable by a car
func ParseOSMSpeedToKM ¶ added in v0.1.2
func PedestrianSpeedMapper ¶ added in v0.1.5
PedestrianSpeedMapper sets to 5km/h and reduces the speed according to the surface of the underlying way
func PedestrianTagMapFilter ¶ added in v0.1.5
PedestrianTagMapFilter filters the map for map tags usable by pedestrians
func ShrinkToHullRect ¶ added in v0.1.15
func ShrinkToHullRect( pbfFile io.ReadSeeker, tagMapFilter TagMapFilter, points [][]float32, margin float64, pbfOutput io.Writer, ) ([][]float64, error)
ShrinkToHullRect writes a new .osm.pbf file to the given pbfOutput writer containing only the ways and nodes that are within the bounding box of the convex hull of the given points expanded by the given margin in meters. It will also remove any ways that do not pass the given tagMapFilter. The returned [][]float64 holds the lower left and upper right lon/lat coordinates describing the expanded bounding box.
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 ¶
Distance returns the length of the shortest possible route between the points
func (DistanceClient) Distances ¶
Distances returns a slice containing the minimum distances from the source to the points in targets.
func (DistanceClient) Matrix ¶
Matrix creates a matrix representing the minimum distances from the points in sources to the points in targets.
func (DistanceClient) Nearest ¶
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 ¶
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 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
type SpeedMapper ¶ added in v0.1.2
func MaxSpeedMapper ¶ added in v0.1.5
func MaxSpeedMapper(maxSpeed int) SpeedMapper
MaxSpeedMapper caps the allowed speed at the given value
type TagMapFilter ¶ added in v0.1.2
func TruckTagMapFilter ¶ added in v0.1.5
func TruckTagMapFilter(truckHeight, truckWidth, truckLength, truckWeight float64) TagMapFilter
TruckTagMapFilter filters the map for map tags usable by trucks
type TransportMode ¶ added in v0.1.2
type TransportMode routingkit.Transport_mode
var ( VehicleMode TransportMode = TransportMode(routingkit.Vehicle) BikeMode TransportMode = TransportMode(routingkit.Bike) PedestrianMode TransportMode = TransportMode(routingkit.Pedestrian) )
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.