File: //var/www/backuptest/script.js
// 從 URL 中解析經度和緯度
var urlParams = new URLSearchParams(window.location.search);
var latitude = urlParams.get('latitude');
var longitude = urlParams.get('longitude');
// 創建一個 URL 用於請求地圖圖片
var url = "https://maps.googleapis.com/maps/api/staticmap?center=25.011624,121.298531&zoom=12&size=400x400&key=AIzaSyB4TlMvqinMbC4h0y3sZUmuHaz-xtvxlLs";
// 發送 GET 請求獲取地圖圖片
fetch(url)
.then(response => response.blob())
.then(blob => {
var mapImage = document.getElementById("mapImage");
var imageURL = URL.createObjectURL(blob);
var img = document.createElement("img");
img.src = imageURL;
mapImage.appendChild(img);
})
.catch(error => {
console.error('Error:', error);
});