Currently supported OSRM APIs are:
Not implemeted yet:
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)
}