-2
這是我目前添加谷歌地圖到我的網站的代碼嗎?如何將Google地圖添加到網站?
<!DOCTYPE html>
<html>
<head>
<style>
#map_canvas {
width: 500px;
height: 400px;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(44.5403, -78.5463),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>
我有2個簡單的問題:
怎樣在我的API密鑰添加使用,以確保我的服務器的IP不會被阻止?
這似乎是使用緯度和緯度。我怎樣才能改變這個使用城市的名字呢?例如,可以輸入「休斯頓」而不是座標?