このチュートリアルは、Google Maps API(ApplicationProgramming Interface) について説明しています。
API は、ソフトウェア・アプリケーションを構築するために使用できる一連のメソッドとツールです。
Google Maps API は、web サイトに地図の表示を可能にします:
次の例は、HTML に Google マップを作成します:
<!DOCTYPE html>
<html>
<body>
<h1>My First Google Map</h1>
<div id="map" style="width:100%;height:500px"></div>
<script>
function myMap() {
var mapCanvas =
document.getElementById("map");
var mapOptions = {
center: new google.maps.LatLng(51.5, -0.2),
zoom: 10
}
var
map = new google.maps.Map(mapCanvas, mapOptions);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?callback=myMap"></script>
</body>
</html>
Try it Yourself »