Show routing demonstration on radar page.
This commit is contained in:
parent
18c7a5f84b
commit
b4817546df
9 changed files with 392 additions and 129 deletions
31
tomtom/example/route-gps/main.go
Normal file
31
tomtom/example/route-gps/main.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue