package routing import ( "fmt" "time" "github.com/paulmach/orb" ) type RoutingService interface { Route(locations []orb.Point) (route *Route, err error) } func NewRoutingService(service_type string, baseUrl string) (RoutingService, error) { if service_type == "valhalla" { return NewValhallaRouting(baseUrl) } return nil, fmt.Errorf("%s routing service not supported", service_type) } type Route struct { Summary RouteSummary Legs []RouteLeg } type RouteSummary struct { Polyline string } type RouteLeg struct { Distance float64 Duration time.Duration Polyline string }