Show routing demonstration on radar page.

This commit is contained in:
Eli Ribble 2026-02-18 04:48:12 +00:00
parent 18c7a5f84b
commit b4817546df
No known key found for this signature in database
9 changed files with 392 additions and 129 deletions

View file

@ -0,0 +1,31 @@
package main
import (
"fmt"
"log"
"github.com/Gleipnir-Technology/nidus-sync/tomtom"
)
func main() {
client := tomtom.NewClient()
// Example 1: Calculate a simple route
traffic := false
routeRequest := &tomtom.CalculateRouteRequest{
Locations: []tomtom.Point{
tomtom.P(52.50931, 13.42936),
tomtom.P(52.50274, 13.43872),
},
Traffic: &traffic,
TravelMode: tomtom.TravelModeCar,
RouteType: tomtom.RouteTypeFastest,
}
routeResp, err := client.CalculateRoute(routeRequest)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Route distance: %d meters\n", routeResp.Routes[0].Summary.LengthInMeters)
}