-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