More Related Content More from Thamon Monwan (13) Script gi-group-119. Week5
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-
scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<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>
20. <body>
<div id="map"></div>
<script>
function initMap() {
var myLatLng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key= YOUR_API_KEY &call
back=initMap">
</script>
</body>
</html>
24. <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'), {
zoom: 16,
center: {lat: 13.277605, lng: 100.926524},
mapTypeId: 'roadmap'
});
var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';
var icons = {
parking: {
icon: iconBase + 'parking_lot_maps.png'
},
library: {
icon: iconBase + 'library_maps.png'
},
info: {
icon: iconBase + 'info-i_maps.png'
}
};
function addMarker(feature) {
var marker = new google.maps.Marker({
position: feature.position,
icon: icons[feature.type].icon,
map: map
});
}
var features = [
{
position: {lat:13.288134, lng:100.912272},
type: 'info'
}, {
25. position: {lat:13.276648,lng :100.924912},
type: 'parking'
}, {
position: {lat:13.279320, lng:100.924994},
type: 'library'
}
];
for (var i = 0, feature; feature = features[i]; i++) {
addMarker(feature);
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js…">
</script>
</body>
</html>
26. week6
!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<title>KML feature details</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
float: left;
height: 100%;
width: 79%;
}
#content-window {
float: left;
font-family: 'Roboto','sans-serif';
height: 100%;
line-height: 30px;
padding-left: 10px;
width: 19%;
}
</style>
</head>
<body>
<div id="map"></div>
<div id="content-window"></div>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: {lat: 13.277605, lng: 100.926524}
});
var kmlLayer = new google.maps.KmlLayer({
url: 'https://sites.google.com/site/testkitta/kitta/bb1.kml…',
suppressInfoWindows: true,
map: map
});
kmlLayer.addListener('click', function(kmlEvent) {
var text = kmlEvent.featureData.description;
27. showInContentWindow(text);
});
function showInContentWindow(text) {
var sidediv = document.getElementById('content-window');
sidediv.innerHTML = text;
}
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js…">
</script>
</body>
</html>
<! Doctype html>
<html>
<head>
<meta name= " มุมมอง "content= " แปรง-scale= 1.0 ">"
<meta charset= " utf-8 ">"
คุณสมบัติ <title>kml details< / title>
<style>
Html, ร่างกาย {
สูง: 100 %;
ขอบ: 0;
ห่าง: 0;
}
#แผนที่ {
อัลลอย: ซ้าย
สูง: 100 %;
ความกว้าง:79 %;
}
#เนื้อหา {หน้าต่าง
อัลลอย: ซ้าย
ครอบครัวแบบอักษร: ' แหล่ะ ', ' sans-อริฟ ';
สูง: 100 %;
Line-ความสูง: 30 พิกเซล)
หน้าอกซ้าย: 10 พิกเซล)
ความกว้าง:19 %;
}
< / style>
< / head>
<body>
<div id= "แผนที่" แมนแมนเตะบอล /div>
<div id= "เนื้อหา-หน้าต่าง" #แมนแมนเตะบอล / div>
<script>
ฟังก์ชัน initmap {()
28. วาร์= แผนที่กูเกิ้ลใหม่ แผนที่ แผนที่ (เอกสาร แผนที่ getelementbyid (' ') {
ซูม:12
Center: {ลาด: 13.277605, แค่ 100.926524}
});
วาร์kmllayer = กูเกิ้ลใหม่ แผนที่ (kmllayer {
Url: https://sites.google.com/site/testkitta/kitta/bb1.kml?attredirects=0&d=1',
Suppressinfowindows: จริงนะ
แผนที่: แผนที่
});
Kmllayer. Addlistener ('คลิก', ฟังก์ชัน (kmlevent) {
วาร์ข้อความ= kmlevent. Featuredata. คาอธิบาย;
Showincontentwindow (ข้อความ)
});
ฟังก์ชัน showincontentwindow {(ข้อความ)
วาร์sidediv = เอกสาร เนื้อหา getelementbyid ('-'); หน้าต่าง
Sidediv. ; ข้อความ innerhtml =
}
}
< / script>
หน่วงไม่ซิงค์ <script
Src=" https://maps.googleapis.com/maps/api/js?key=AIzaSyDl1_2_FBFOuHO3xee3zGYrxU
lU1FIqFMI&callback=initMap">
< / script>
< / body>
< / html>