@@ -67,6 +67,7 @@ async function initMap() {
6767 fields : [ 'path' ] ,
6868 } ;
6969 // [END maps_routes_get_directions_request_pluscode]
70+ // [START maps_routes_get_directions_request_complete]
7071 // [START maps_routes_get_directions_request_simple]
7172 // Define a routes request.
7273 const request = {
@@ -77,12 +78,9 @@ async function initMap() {
7778 } ;
7879 // [END maps_routes_get_directions_request_simple]
7980 // Call computeRoutes to get the directions.
80- //@ts -ignore
8181 // [START maps_routes_get_directions_compute]
8282 const { routes, fallbackInfo, geocodingResults } = await Route . computeRoutes ( request ) ;
8383 // [END maps_routes_get_directions_compute]
84- // Display the raw JSON for the result in the console.
85- console . log ( `Response:\n ${ JSON . stringify ( routes , null , 2 ) } ` ) ;
8684 // [START maps_routes_get_directions_polyline]
8785 // Use createPolylines to create polylines for the route.
8886 mapPolylines = routes [ 0 ] . createPolylines ( ) ;
@@ -93,6 +91,10 @@ async function initMap() {
9391 // Add markers to the map
9492 markers . forEach ( ( marker ) => marker . setMap ( map ) ) ;
9593 // [END maps_routes_get_directions_polyline]
94+ // [END maps_routes_get_directions_request_complete]
95+ // Display the raw JSON for the result in the console.
96+ console . log ( `Response:\n ${ JSON . stringify ( routes , null , 2 ) } ` ) ;
97+ // Fit the map to the path.
9698 fitMapToPath ( routes [ 0 ] . path ) ;
9799}
98100// Helper function to fit the map to the path.
0 commit comments