forked from LiveCoronaDetector/livecod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_naver_map_test.html
85 lines (80 loc) · 2.57 KB
/
index_naver_map_test.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>간단한 지도 표시하기</title>
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=26ba2oaskk"></script>
</head>
<body>
<div id="map" style="width:100%;height:400px;"></div>
<script src="marker.js"></script>
<script>
var data = marker
var seoul = {"lat": 37.5456299, "lng": 126.9540667};
console.log(seoul["lat"]);
console.log(seoul["lng"]);
var mapOptions = {
center: new naver.maps.LatLng(seoul["lat"], seoul["lng"]),
zoom: 6
};
var map = new naver.maps.Map('map', mapOptions); // Map 객체
function makePoint(lat, lng, countryName, confirmed, death) {
var point = new naver.maps.LatLng(lat, lng);
var contentString = [
'<div class="iw_inner">',
' <p style="font-size: small">국가이름 : ',countryName,'<br>',
'확진자수 : ',confirmed,'<br>',
'사망자수 :',death,'<br>',
'</p>',
'</div>'
].join('');
var infowindow = new naver.maps.InfoWindow({
content: contentString,
maxWidth: 140,
backgroundColor: "#eee",
borderColor: "#ffffff",
borderWidth: 3,
anchorSize: new naver.maps.Size(30, 30),
anchorSkew: true,
anchorColor: "#eee",
pixelOffset: new naver.maps.Point(20, -20)
});
var marker = new naver.maps.Marker({
map:map, position:point
});
var circle = new naver.maps.Circle({
map: map,
center: point,
radius: confirmed*1000,
strokeWeight: 3,
fillColor: "#ff0000",
fillOpacity: 0.7
});
naver.maps.Event.addListener(marker, "click", function(e) {
if (infowindow.getMap()) {
infowindow.close();
} else {
infowindow.open(map, marker);
}
});
infowindow.open(map, marker);
}//국가별 감염자 마커
makePoint(37.5456299, 126.9540667, '대한민국', 15, 0);//테스트용
function makeMedicalCenter(lat, lng){
var markerOptions = {
position: {lat:lat, lng:lng},
map: map,
icon: {
url: './img/red_cross.svg',
size: new naver.maps.Size(50, 52),
scaledSize: new naver.maps.Size(25, 26),
}
};
var marker = new naver.maps.Marker(markerOptions);
}//선별 진료소 위치
makeMedicalCenter(39.4, 127);//테스트용
</script>
</body>
</html>