Messtone LLC Manages(v8):Routing

Messtone Devices Enables v8 Routing API package main import(“context” “fmt” “net/http” “os” go.einride.tech/here/routingv8″)function main( ){ctx :=context.Background( ) apiKey := os.Getenv(“HERE_API_KEY”) //Create an authenticated client routingClient := routingv8.NewAPIKeyHTTPClient(apiKey,http.DefaltClient.Transport),) //Einride Gothenburg.origins := [ ]*routingv8.GeoWaypoint{{Lat : 57.707752,Long : 11.949767,},} //Einride Stockholm.destinations := [ ]*routingv8.GeoWaypoint{{Lat : 59.337492, Long : 18.063672,},} //Call Here Maps API response, err := routingClient.Matrix.CalculateMatrix(ctx, &routingv8.CalculateMatrixRequest{Async : false, Body : &routingv8.CalculateMatrixBody{Origins : origins, Destinations : destinations,Region definition : routingv8. RegionDefinition{Type : routingv8.RegionType_World,},Profile : routingv8.Profile_TruckFast,MatrixAttributes : &routingv8.MatrixAttributes{routingv8.MatrixAttribute_Distances,routingv8.MatrixAttribute_TravelTimes,},},})if err !=nil{panic(err) //TODO : handle error}//Handle result fmt.Printf(“matrix ID : %s \n”,response.MatrixID)for i, distance := range response.Matrix.Distances{fmt.Printf(“Route %d : %d meters \n”, i, distance)}} v7 Geocoding & search API package main import (“context” “fmt” “net/http” “os” “go.einride.tech/here/geocodingsearchv7”)function main( ){ctx := context.Background( )apiKey := os.Getenv(“HERE_API_KEY”) //Create an authenticated client geocodingClient :=geocodingsearchv7.NewClient(geocodingv7.NewAPIKeyHTTPClient(apiKey,http.DefaultClient.Transport),) //The query to geocode q :=”Regeringsgatan 65, Stockholm” //Call Here Maps API response.err := geocodingClient.Geocoding.GeoCoding(ctx, &geocodingsearchv7.GeocodingRequest{Q : &q,})if err !=nil{panic(err) //TODO : handle error} //Handle result for _,item := range resources.Items{fmt.Printf(“Geocode location lat/lng : %f %f \n”, item.Position.Lat,item.Position.Long)}}

UNITED STATES – OCTOBER 08: A Ryder truck pulls into a Ryder rental location in the Queens borough of New York, U.S., on Monday, Oct. 8, 2007. Ryder System Inc., the largest U.S. truck-leasing company, said third-quarter earnings were less than it forecast as the economy weakened beyond housing and reduced demand for freight-hauling trucks. The shares fell the most since 2004. (Photo by Jb Reed/Bloomberg via Getty Images)

Leave a comment