directionsmatrix

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codes

type Codes string

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

const (
	// CodeOK success response
	CodeOK Codes = "Ok"
	//CodeProfileNotFound invalid routing profile
	CodeProfileNotFound Codes = "ProfileNotFound"
	// CodeInvalidInput invalid input data to the server
	CodeInvalidInput Codes = "InvalidInput"
)

type DirectionMatrixResponse

type DirectionMatrixResponse struct {
	Code         string
	Durations    [][]float64
	Sources      []Waypoint
	Destinations []Waypoint
}

DirectionMatrixResponse is the response from GetDirections https://www.mapbox.com/api-documentation/#matrix-response-format

type DirectionsMatrix

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

DirectionsMatrix api wrapper instance

func NewDirectionsMatrix

func NewDirectionsMatrix(base *base.Base) *DirectionsMatrix

NewDirectionsMatrix Create a new Directions Matrix API wrapper

func (*DirectionsMatrix) GetDirectionsMatrix

func (d *DirectionsMatrix) GetDirectionsMatrix(locations []base.Location, profile RoutingProfile, opts *RequestOpts) (*DirectionMatrixResponse, error)

GetDirectionsMatrix between a set of locations using the specified routing profile

type RequestOpts

type RequestOpts struct {
	Sources      string `url:"sources,omitempty"`
	Destinations string `url:"destinations,omitempty"`
}

RequestOpts request options for directions api

func (*RequestOpts) SetDestinations

func (o *RequestOpts) SetDestinations(destinations []string)

SetDestinations The points which will act as the destinations.

func (*RequestOpts) SetSources

func (o *RequestOpts) SetSources(sources []string)

SetSources The points which will act as the starting point.

type RoutingProfile

type RoutingProfile string

RoutingProfile defines routing mode for direction matrix finding

const (
	// 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 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