-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不会被阻止?
这似乎是使用纬度和纬度。我怎样才能改变这个使用城市的名字呢?例如,可以输入“休斯顿”而不是坐标?