Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions dist/samples/routes-get-directions/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ async function initMap(): Promise<void> {
};
// [END maps_routes_get_directions_request_pluscode]

// [START maps_routes_get_directions_request_complete]
// [START maps_routes_get_directions_request_simple]
// Define a routes request.
const request = {
Expand All @@ -87,14 +88,10 @@ async function initMap(): Promise<void> {
// [END maps_routes_get_directions_request_simple]

// Call computeRoutes to get the directions.
//@ts-ignore
// [START maps_routes_get_directions_compute]
const {routes, fallbackInfo, geocodingResults} = await Route.computeRoutes(request);
// [END maps_routes_get_directions_compute]

// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);

// [START maps_routes_get_directions_polyline]
// Use createPolylines to create polylines for the route.
mapPolylines = routes[0].createPolylines();
Expand All @@ -106,7 +103,12 @@ async function initMap(): Promise<void> {
// Add markers to the map
markers.forEach((marker) => marker.setMap(map));
// [END maps_routes_get_directions_polyline]
// [END maps_routes_get_directions_request_complete]

// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);

// Fit the map to the path.
fitMapToPath(routes[0].path!);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/samples/routes-get-directions/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<head>
<title>Get directions</title>

<script type="module" crossorigin src="./assets/index-CQ7LYNHt.js"></script>
<script type="module" crossorigin src="./assets/index-CXMSbPFr.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-kz-ac4rW.css">
</head>
<body>
Expand Down
8 changes: 5 additions & 3 deletions dist/samples/routes-get-directions/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ async function initMap() {
fields: ['path'],
};
// [END maps_routes_get_directions_request_pluscode]
// [START maps_routes_get_directions_request_complete]
// [START maps_routes_get_directions_request_simple]
// Define a routes request.
const request = {
Expand All @@ -77,12 +78,9 @@ async function initMap() {
};
// [END maps_routes_get_directions_request_simple]
// Call computeRoutes to get the directions.
//@ts-ignore
// [START maps_routes_get_directions_compute]
const { routes, fallbackInfo, geocodingResults } = await Route.computeRoutes(request);
// [END maps_routes_get_directions_compute]
// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);
// [START maps_routes_get_directions_polyline]
// Use createPolylines to create polylines for the route.
mapPolylines = routes[0].createPolylines();
Expand All @@ -93,6 +91,10 @@ async function initMap() {
// Add markers to the map
markers.forEach((marker) => marker.setMap(map));
// [END maps_routes_get_directions_polyline]
// [END maps_routes_get_directions_request_complete]
// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);
// Fit the map to the path.
fitMapToPath(routes[0].path);
}
// Helper function to fit the map to the path.
Expand Down
10 changes: 6 additions & 4 deletions dist/samples/routes-get-directions/docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ async function initMap(): Promise<void> {
};
// [END maps_routes_get_directions_request_pluscode]

// [START maps_routes_get_directions_request_complete]
// [START maps_routes_get_directions_request_simple]
// Define a routes request.
const request = {
Expand All @@ -87,14 +88,10 @@ async function initMap(): Promise<void> {
// [END maps_routes_get_directions_request_simple]

// Call computeRoutes to get the directions.
//@ts-ignore
// [START maps_routes_get_directions_compute]
const {routes, fallbackInfo, geocodingResults} = await Route.computeRoutes(request);
// [END maps_routes_get_directions_compute]

// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);

// [START maps_routes_get_directions_polyline]
// Use createPolylines to create polylines for the route.
mapPolylines = routes[0].createPolylines();
Expand All @@ -106,7 +103,12 @@ async function initMap(): Promise<void> {
// Add markers to the map
markers.forEach((marker) => marker.setMap(map));
// [END maps_routes_get_directions_polyline]
// [END maps_routes_get_directions_request_complete]

// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);

// Fit the map to the path.
fitMapToPath(routes[0].path!);
}

Expand Down
8 changes: 5 additions & 3 deletions dist/samples/routes-get-directions/jsfiddle/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ async function initMap() {
};



// Define a routes request.
const request = {
origin: 'Mountain View, CA',
Expand All @@ -77,12 +78,9 @@ async function initMap() {
};

// Call computeRoutes to get the directions.
//@ts-ignore

const { routes, fallbackInfo, geocodingResults } = await Route.computeRoutes(request);

// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);

// Use createPolylines to create polylines for the route.
mapPolylines = routes[0].createPolylines();
Expand All @@ -93,6 +91,10 @@ async function initMap() {
// Add markers to the map
markers.forEach((marker) => marker.setMap(map));


// Display the raw JSON for the result in the console.
console.log(`Response:\n ${JSON.stringify(routes, null, 2)}`);
// Fit the map to the path.
fitMapToPath(routes[0].path);
}
// Helper function to fit the map to the path.
Expand Down
2 changes: 2 additions & 0 deletions dist/samples/routes-route-matrix/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ async function initMap(): Promise<void> {
destinationB.fetchFields({ fields: ['location', 'displayName']}),
]);

// [START maps_routes_route_matrix_request]
const request = {
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: 'DRIVING',
units: google.maps.UnitSystem.METRIC,
fields: ['distanceMeters', 'durationMillis', 'condition'],
};
// [END maps_routes_route_matrix_request]

// Show the request.
(document.getElementById("request") as HTMLDivElement).innerText =
Expand Down
2 changes: 2 additions & 0 deletions dist/samples/routes-route-matrix/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ async function initMap() {
destinationA.fetchFields({ fields: ['location', 'displayName'] }),
destinationB.fetchFields({ fields: ['location', 'displayName'] }),
]);
// [START maps_routes_route_matrix_request]
const request = {
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: 'DRIVING',
units: google.maps.UnitSystem.METRIC,
fields: ['distanceMeters', 'durationMillis', 'condition'],
};
// [END maps_routes_route_matrix_request]
// Show the request.
document.getElementById("request").innerText =
JSON.stringify(request, null, 2);
Expand Down
2 changes: 2 additions & 0 deletions dist/samples/routes-route-matrix/docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ async function initMap(): Promise<void> {
destinationB.fetchFields({ fields: ['location', 'displayName']}),
]);

// [START maps_routes_route_matrix_request]
const request = {
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: 'DRIVING',
units: google.maps.UnitSystem.METRIC,
fields: ['distanceMeters', 'durationMillis', 'condition'],
};
// [END maps_routes_route_matrix_request]

// Show the request.
(document.getElementById("request") as HTMLDivElement).innerText =
Expand Down
2 changes: 2 additions & 0 deletions dist/samples/routes-route-matrix/jsfiddle/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ async function initMap() {
destinationA.fetchFields({ fields: ['location', 'displayName'] }),
destinationB.fetchFields({ fields: ['location', 'displayName'] }),
]);

const request = {
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: 'DRIVING',
units: google.maps.UnitSystem.METRIC,
fields: ['distanceMeters', 'durationMillis', 'condition'],
};

// Show the request.
document.getElementById("request").innerText =
JSON.stringify(request, null, 2);
Expand Down