-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaipei.html
More file actions
103 lines (85 loc) · 3.14 KB
/
Taipei.html
File metadata and controls
103 lines (85 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Vincent map</title>
<!--Bootstrap - Lastest compiled and minified CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css">
<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="resources/leadlet.ajax.js"></script>
<style>
html,
body {
height: 100%;
}
body {
display: flex;
flex-direction: column;
}
#header {
height: 40px;
background-color: darkgoldenrod;
}
#main {
flex: 1;
}
#mapdiv {
height: 100%;
background-color: salmon;
}
#side_panel {
height: 100%;
background-color: beige;
}
#footer {
height: 75px;
background-color: darkgrey;
}
</style>
</head>
<body>
<div id="header" class="col-md-12">
<h1 class=text-center style="font-size:20px;">Vincent's City</h1>
</div>
<div id="main">
<div id="side_panel" class="col-md-3">
<h1 class="text-center">Attractions</h1>
<button id='zoomToWork' class="form-control btn-primary">中興工程</button>
<hr>
<button id='zoomToAirport' class="form-control btn-primary">松山機場</button>
</div>
<div id="mapdiv" class="col-md-9"></div>
</div>
<div id="footer" class="col-md-12">
<h4 id="map_coords" class="text-center">Latitude: 25.3 Longtitude: 121.5 Zoom Level:11 </h4>
<h4 class="text-center">©2020 <a href="http://millermountain.com">Vincent's Fans</a></h4>
</div>
</body>
<script>
var mymap = L.map('mapdiv')
mymap.setView([25.3, 121.5], 11); //Lat;Lon 按照順序
var backgroundLayer = L.tileLayer("https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.jpg");
mymap.addLayer(backgroundLayer);
var work = L.circleMarker([25.05168, 121.56351], color = "red", draggable = true, opacity = 0.5);
work.addTo(mymap);
work.bindPopup(
"<h3 class='text-center'>Vincent </h1><a href='https://github.com/kobesin/GeoConvert/pulls' target='blank'><img src='https://avatars1.githubusercontent.com/u/5188396?s=400&v=4' width='200px'></a>"
);
$("#zoomToWork").click(function () {
mymap.setView([25.05168, 121.56351], 15)
});
$("#zoomToAirport").click(function () {
mymap.setView([25.06974, 121.55145], 15)
});
//這個是用Jquery的功能,針對點擊左側的Btn反應
mymap.on('mousemove', function (e) {
var str = 'Latitude: ' + e.latlng.lat.toFixed(5) + ' Longitude: ' +
e.latlng.lng.toFixed(5) + ' Zoom Level: ' + mymap.getZoom();
$('#map_coords').html(str)
})
//這個是用leaflet.js的功能,可以call mousemove
var geojsonLayer = new L.GeoJson.AJAX('attratcion')
</script>
</html>