-1
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: 30.3434,
lng: 30.234
},
zoom: 8
});
}
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<div id="map"></div>
<script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap" async defer></script>
如何輸入座標自動谷歌API的Java腳本?! 這裏是代碼
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat:30.3434, lng:30.234},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap"
async defer></script>
</body>
</html>
我想「中心」,採取從一個txt文件中的座標,在我的電腦在作爲測試
你能澄清你的問題?你是否願意知道你應該在哪裏寫你的座標? –
自動您的意思是**動態**權利? –
那麼你知道如何加載文件嗎? – epascarello