From 996f55cde631c28fec160c2de4ecd957516ee867 Mon Sep 17 00:00:00 2001 From: Tetsuo Kawakami Date: Wed, 24 Jan 2024 16:52:39 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E4=BD=93=E7=9A=84=E3=81=AA=E3=83=AA?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo2.html | 2 +- ai.js => route.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) rename ai.js => route.js (80%) diff --git a/demo2.html b/demo2.html index 90f0a00..40b4419 100644 --- a/demo2.html +++ b/demo2.html @@ -14,6 +14,6 @@
- + \ No newline at end of file diff --git a/ai.js b/route.js similarity index 80% rename from ai.js rename to route.js index 09b76d4..1f1473a 100644 --- a/ai.js +++ b/route.js @@ -2,7 +2,7 @@ function initMap() { // Create a new map instance const map = new google.maps.Map(document.getElementById("map"), { - center: { lat: 35.6895, lng: 139.6917 }, // 東京の座標 + center: { lat: 35.638591, lng: 139.746087 }, // 開始、終了位置位置の座標 zoom: 12, // Set the initial zoom level }); @@ -60,8 +60,9 @@ function initMap() { (response, status) => { if (status === "OK") { directionsRenderer.setDirections(response); + displayRouteAddresses(response.routes[0]); } else { - console.log("Directions request failed due to " + status); + console.log("次の理由で巡回ルートの計算に失敗しました:【" + status + "】" ); } } ); @@ -71,4 +72,11 @@ function initMap() { // Call the cycleMarkers function to start cycling through the markers cycleMarkers(); + + // Function to display the route addresses + function displayRouteAddresses(route) { + const addresses = route.legs.map((leg) => leg.end_address); + console.log(addresses); + // Display the addresses in your desired way (e.g., update a DOM element) + } }