directions

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Distance []float64
	Duration []float64
	Speed    []float64
}

Annotation conains additional details about each line segment https://www.mapbox.com/api-documentation/#routeleg-object

type AnnotationType

type AnnotationType string
const (
	AnnotationDuration AnnotationType = "duration"
	AnnotationDistance AnnotationType = "distance"
	AnnotationSpeed    AnnotationType = "speed"
)

type Codes

type Codes string

Codes are direction response Codes https://www.mapbox.com/api-documentation/#directions-errors

const (
	CodeOK              Codes = "Ok"
	CodeNoRoute         Codes = "NoRoute"
	CodeNoSegment       Codes = "NoSegment"
	CodeProfileNotFound Codes = "ProfileNotFound"
	CodeInvalidInput    Codes = "InvalidInput"
)

type DirectionResponse

type DirectionResponse struct {
	Code      string
	Waypoints []Waypoint
	Routes    []Route
}

DirectionResponse is the response from GetDirections https://www.mapbox.com/api-documentation/#directions-response-object

type Directions

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

Directions api wrapper instance

func NewDirections

func NewDirections(base *base.Base) *Directions

NewDirections Create a new Directions API wrapper

func (*Directions) GetDirections

func (g *Directions) GetDirections(locations []base.Location, profile RoutingProfile, opts *RequestOpts) (*DirectionResponse, error)

GetDirections between a set of locations using the specified routing profile

type GeometryType

type GeometryType string
const (
	GeometryGeojson   GeometryType = "geojson"
	GeometryPolyline  GeometryType = "polyline"
	GeometryPolyline6 GeometryType = "polyline6"
)

type Intersection

type Intersection struct {
	Location []float64
	Bearings []float64
	Entry    []bool
	In       uint
	Out      uint
	Lanes    []Lane
}

Intersection https://www.mapbox.com/api-documentation/#routestep-object

type Lane

type Lane struct {
	Valid      bool
	Indicatons []string
}

Lane https://www.mapbox.com/api-documentation/#lane-object

type OverviewType

type OverviewType string
const (
	OverviewFull       OverviewType = "full"
	OverviewSimplified OverviewType = "simplified"
	OverviewFalse      OverviewType = "false"
)

type RadiusType

type RadiusType string
const (
	RaduisUnlimited RadiusType = "unlimited"
)

type RequestOpts

type RequestOpts struct {
	Alternatives       bool          `url:"alternatives,omitempty"`
	Geometries         *GeometryType `url:"geometries,omitempty"`
	Overview           *OverviewType `url:"overview,omitempty"`
	Radiuses           string        `url:"radiuses,omitempty"`
	Steps              bool          `url:"steps,omitempty"`
	ContinueStraight   bool          `url:"continue_straight,omitempty"`
	Bearings           string        `url:"bearings,omitempty"`
	Annotations        string        `url:"annotations,omitempty"`
	Language           string        `url:"language,omitempty"`
	Exclude            string        `url:"exclude,omitempty"`
	RoundaboutExits    bool          `url:"roundabout_exits,omitempty"`
	VoiceInstructions  bool          `url:"voice_instructions,omitempty"`
	BannerInstructions bool          `url:"banner_instructions,omitempty"`
	VoiceUnits         string        `url:"voice_units,omitempty"`
}

RequestOpts request options for directions api

func (*RequestOpts) SetAnnotations

func (o *RequestOpts) SetAnnotations(annotations []AnnotationType)

SetAnnotations builds the annotations query argument from an array of annotation types

func (*RequestOpts) SetBearings

func (o *RequestOpts) SetBearings(angles []float64, deviations []float64) error

SetBearings builds the bearings query argument from an array of angles and deviations Note that this must be used with SetRadiuses and the length of the associated arrays must be the same

func (*RequestOpts) SetRadiuses

func (o *RequestOpts) SetRadiuses(radiuses []float64)

SetRadiuses sets radiuses for the maximum distance any coordinate can move when snapped to nearby road segment. This must have the same number of radiuses as locations in the GetDirections request

type Route

type Route struct {
	Distance float64
	Duration float64
	Geometry string
	Legs     []RouteLeg
}

Route A route through (potentially multiple) waypoints. https://www.mapbox.com/api-documentation/#route-object

type RouteLeg

type RouteLeg struct {
	Distance   float64
	Duration   float64
	Steps      []RouteStep
	Summary    string
	Annotation Annotation
}

RouteLeg A route between two Waypoints https://www.mapbox.com/api-documentation/#routeleg-object

type RouteStep

type RouteStep struct {
	Distance      float64
	Duration      float64
	Geometry      string
	Name          string
	Ref           string
	Destinations  string
	Mode          TransportationMode
	Maneuver      StepManeuver
	Intersections []Intersection
}

RouteStep Includes one StepManeuver object and travel to the following RouteStep. https://www.mapbox.com/api-documentation/#routestep-object

type RoutingProfile

type RoutingProfile string

RoutingProfile defines routing mode for direction finding

const (
	// RoutingDrivingTraffic mode for automotive routing takes into account current and historic traffic
	RoutingDrivingTraffic RoutingProfile = "mapbox/driving-traffic"
	// RoutingDriving mode for for automovide routing
	RoutingDriving RoutingProfile = "mapbox/driving"
	// RoutingWalking mode for Pedestrian routing
	RoutingWalking RoutingProfile = "mapbox/walking"
	// RoutingCycling mode for bicycle routing
	RoutingCycling RoutingProfile = "mapbox/cycling"
)

type StepManeuver

type StepManeuver struct {
	Location      []float64
	BearingBefore float64
	BearingAfter  float64
	Instruction   string
	Type          string
	Modifier      StepModifier
}

StepManeuver https://www.mapbox.com/api-documentation/#stepmaneuver-object

type StepModifier

type StepModifier string

StepModifier indicates the direction change of the maneuver https://www.mapbox.com/api-documentation/#stepmaneuver-object

const (
	StepModifierUTurn       StepModifier = "uturn"
	StepModifierSharpRight  StepModifier = "sharp right"
	StepModifierRight       StepModifier = "right"
	StepModifierSlightRight StepModifier = "slight right"
	StepModifierStraight    StepModifier = "straight"
	StepModifierSharpLeft   StepModifier = "sharp left"
	StepModifierLeft        StepModifier = "left"
	StepModifierSlightLeft  StepModifier = "slight left"
)

type TransportationMode

type TransportationMode string

TransportationMode indicates the mode of transportation https://www.mapbox.com/api-documentation/#routestep-object

const (
	ModeDriving      TransportationMode = "driving"
	ModeWalking      TransportationMode = "walking"
	ModeFerry        TransportationMode = "ferry"
	ModeCycling      TransportationMode = "cyling"
	ModeUnaccessible TransportationMode = "unaccessible"
)

type Waypoint

type Waypoint struct {
	Name     string
	Location []float64
}

Waypoint is an input point snapped to the road network https://www.mapbox.com/api-documentation/#waypoint-object

Jump to

Keyboard shortcuts

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