Skip to content

Commit

Permalink
Merge pull request #30 from nextmv-io/feature/eng-3202-location-conve…
Browse files Browse the repository at this point in the history
…rsion

ENG-3202 Add a conversion function for schema.Location to measure.Point
  • Loading branch information
muellerd authored Apr 22, 2024
2 parents 1ff50a3 + 83f21d0 commit 980b2b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions schema/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package schema

import (
"time"

"github.com/nextmv-io/sdk/measure"
)

// Input is the default input schema for nextroute.
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 980b2b5

Please sign in to comment.