Categorygithub.com/machship-mm/go.osrm
modulepackage
0.1.1
Repository: https://github.com/machship-mm/go.osrm.git
Documentation: pkg.go.dev

# README

Go client library for OSRM

GoDoc Build Status Go Report Card codecov

Description

Currently supported OSRM APIs are:

Not implemeted yet:

Usage

Sample usage:

package main

import (
	"context"
	"log"
	"time"

	osrm "github.com/gojuno/go.osrm"
	geo "github.com/paulmach/go.geo"
)

func main() {
	client := osrm.NewFromURL("https://router.project-osrm.org")

	ctx, cancelFn := context.WithTimeout(context.Background(), time.Second)
	defer cancelFn()

	resp, err := client.Route(ctx, osrm.RouteRequest{
		Profile: "car",
		Coordinates: osrm.NewGeometryFromPointSet(geo.PointSet{
			{-73.980020, 40.751739},
			{-73.962662, 40.794156},
		}),
		Steps:       osrm.StepsTrue,
		Annotations: osrm.AnnotationsTrue,
		Overview:    osrm.OverviewFalse,
		Geometries:  osrm.GeometriesPolyline6,
	})
	if err != nil {
		log.Fatalf("route failed: %v", err)
	}

	log.Printf("routes are: %+v", resp.Routes)
}

# Functions

New creates a client with default server url and default timeout.
NewFromURL creates a client with custom server url and default timeout.
NewFromURLWithTimeout creates a client with custom timeout connection.
NewGeometryFromPath creates a geometry from a path.
NewGeometryFromPointSet creates a geometry from points set.
NewWithConfig creates a client with given config.

# Constants

Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
Supported annotations param values.
ContinueStraight values.
ContinueStraight values.
ContinueStraight values.
No description provided by the author
No description provided by the author
No description provided by the author
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
Error codes that could be returned from OSRM.
No description provided by the author
No description provided by the author
No description provided by the author
Supported gaps param values.
Supported gaps param values.
Supported geometries param values.
Supported geometries param values.
Available overview values.
Available overview values.
Available overview values.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Supported steps param values.
Supported steps param values.
Supported tidy param values.
Supported tidy param values.

# Variables

Invalid request errors.
Invalid request errors.
Invalid request errors.
Invalid request errors.

# Structs

Annotation contains additional metadata for each coordinate along the route geometry.
Bearing limits the search to segments with given bearing in degrees towards true north in clockwise direction.
Config represents OSRM client configuration options.
Geometry represents a points set.
No description provided by the author
No description provided by the author
Matching represents an array of Route objects that assemble the trace.
MatchRequest represents a request to the match method.
MatchResponse represents a response from the match method.
NearestRequest represents a request to the nearest method.
NearestResponse represents a response from the nearest method.
NearestWaypoint represents a nearest point on a nearest query.
OSRM implements the common OSRM API v5.
ResponseStatus represent OSRM API response.
Route represents a route through (potentially multiple) points.
RouteLeg represents a route between two waypoints.
RouteRequest represents a request to the route method.
RouteResponse represents a response from the route method.
RouteStep represents a route geometry.
StepManeuver contains information about maneuver in step.
TableRequest represents a request to the table method.
TableResponse resresents a response from the table method.
Tracepoint represents a matched point on a route.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

Annotations represents a annotations param for osrm5 request.
ContinueStraight represents continue_straight OSRM routing parameter.
No description provided by the author
No description provided by the author
Gaps represents a gaps param for osrm5 match request.
Geometries represents a geometries param for osrm5.
Overview represents level of overview of geometry in a response.
No description provided by the author
No description provided by the author
Steps represents a steps param for osrm5 request.
Tidy represents a tidy param for osrm5 match request.