mapmatching

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 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 AnnotationType

type AnnotationType string

AnnotationType type of metadata to be returned additionally along the route

const (
	// AnnotationDuration returns a additional duration metadata
	AnnotationDuration AnnotationType = "duration"
	// AnnotationDistance returns a additional distance metadata
	AnnotationDistance AnnotationType = "distance"
	// AnnotationSpeed returns a additional speed metadata
	AnnotationSpeed AnnotationType = "speed"
)

type Codes

type Codes string

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

const (
	// CodeOK success response
	CodeOK Codes = "Ok"
	//NoMatchFound No matching route found
	NoMatchFound Codes = "NoMatch"
	//TooManyCoordinates limited to 100 coordinates per request
	TooManyCoordinates Codes = "TooManyCoordinates"
	//CodeProfileNotFound invalid routing profile
	CodeProfileNotFound Codes = "ProfileNotFound"
	// CodeInvalidInput invalid input data to the server
	CodeInvalidInput Codes = "InvalidInput"
)

type Coordinate

type Coordinate []float64

type GeojsonGeometry

type GeojsonGeometry struct {
	Coordinates []Coordinate
}

type GeometryType

type GeometryType string

GeometryType Format of the returned geometry

const (
	// GeometryGeojson returns a geojson like geometry
	GeometryGeojson GeometryType = "geojson"
	// GeometryPolyline returns a polyline 5 encoded string like geometry
	GeometryPolyline GeometryType = "polyline"
	// GeometryPolyline6 returns a polyline 6 encode string like geometry
	GeometryPolyline6 GeometryType = "polyline6"
)

type MapMatching

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

MapMatching api wrapper instance

func NewMapMaptching

func NewMapMaptching(base *base.Base) *MapMatching

NewMapMaptching Create a new Map Matching API wrapper

func (*MapMatching) GetMatching

func (d *MapMatching) GetMatching(path []base.Location, profile RoutingProfile, opts *RequestOpts) (*MatchingResponse, error)

GetMatching for a path using the specified routing profile

type MatchingLeg

type MatchingLeg struct {
	Step     []float64
	Summary  string
	Duration float64
	Distance float64
}

MatchingLeg legs inside the matching object

type MatchingResponse

type MatchingResponse struct {
	Code       string
	Matchings  []Matchings
	Tracepoint []TracePoint
}

MatchingResponse is the response from GetMatching https://www.mapbox.com/api-documentation/#match-response-object

type Matchings

type Matchings struct {
	Confidence float64
	Distance   float64
	Duration   float64
	Geometry   interface{} // Issue: must support polyline (string) or geojson (object)
	Legs       []MatchingLeg
}

Matchings it a route object with additional confidence field https://www.mapbox.com/api-documentation/#match-object

func (*Matchings) GetGeometryGeojson

func (m *Matchings) GetGeometryGeojson() (*GeojsonGeometry, error)

func (*Matchings) GetGeometryPolyline

func (m *Matchings) GetGeometryPolyline() (string, error)

type OverviewType

type OverviewType string

OverviewType Type of returned overview geometry

const (
	//OverviewFull returns a detailed overview geometry
	OverviewFull OverviewType = "full"
	//OverviewSimplified returns a simplified overview geometry
	OverviewSimplified OverviewType = "simplified"
	//OverviewFalse returns no overview geometry
	OverviewFalse OverviewType = "false"
)

type PolylineGeometry

type PolylineGeometry string

type RequestOpts

type RequestOpts struct {
	Geometries  GeometryType    `url:"geometries,omitempty"`
	Radiuses    string          `url:"radiuses,omitempty"`
	Steps       bool            `url:"steps,omitempty"`
	Overview    OverviewType    `url:"overview,omitempty"`
	Timestamps  string          `url:"timestamps,omitempty"`
	Annotations *AnnotationType `url:"annotations,omitempty"`
}

RequestOpts request options for map matching api

func (*RequestOpts) SetAnnotations

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

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

func (*RequestOpts) SetGeometries

func (o *RequestOpts) SetGeometries(geometrytype GeometryType)

SetGeometries builds the geometry query argument from the specified geometry type

func (*RequestOpts) SetOverview

func (o *RequestOpts) SetOverview(overviewtype OverviewType)

SetOverview builds the overview query argument from the specified overview type

func (*RequestOpts) SetRadiuses

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

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 GetMatching request

func (*RequestOpts) SetSteps

func (o *RequestOpts) SetSteps(steps bool)

SetSteps builds the steps query argument from an array of steps option

func (*RequestOpts) SetTimestamps

func (o *RequestOpts) SetTimestamps(timestamps []int64)

SetTimestamps builds the Timestamps query argument from an array of timestamps types This must have the same number of timestamps as locations in the GetMatching request

type RoutingProfile

type RoutingProfile string

RoutingProfile defines routing mode for map matching

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 TracePoint

type TracePoint struct {
	WaypointIndex  int16
	Location       []float64
	Name           string
	MatchingsIndex int16
}

TracePoint represents the location an input point was matched with

Jump to

Keyboard shortcuts

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