diff --git a/schema/input.go b/schema/input.go index b58fcf8..785f6d0 100644 --- a/schema/input.go +++ b/schema/input.go @@ -5,6 +5,8 @@ package schema import ( "time" + + "github.com/nextmv-io/sdk/measure" ) // Input is the default input schema for nextroute. @@ -226,6 +228,11 @@ type Location struct { Lat float64 `json:"lat" minimum:"-90" maximum:"90"` } +// ToPoint converts a schema.Location to a measure.Point. +func (l Location) ToPoint() measure.Point { + return measure.Point{l.Lon, l.Lat} +} + // DurationGroup represents a group of stops that get additional duration // whenever a stop of the group is approached for the first time. type DurationGroup struct {