-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkakaomap.html
More file actions
47 lines (38 loc) · 1.42 KB
/
Copy pathkakaomap.html
File metadata and controls
47 lines (38 loc) · 1.42 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Kakao 지도 시작하기</title>
</head>
<body>
<div id="map" style="width:500px;height:400px;"></div>
<script type="text/javascript"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=f2e17aeed3c1967e0b52038107786813"></script>
<script>
navigator.geolocation.getCurrentPosition((position) => {
//https://apis.map.kakao.com/web/guide/
var container = document.getElementById('map');
var options = {
center: new kakao.maps.LatLng(position.coords.latitude, position.coords.longitude),
level: 3
};
var map = new kakao.maps.Map(container, options);
// 마커가 표시될 위치입니다
var markerPosition = new kakao.maps.LatLng(position.coords.latitude, position.coords.longitude);
// 마커를 생성합니다
var marker = new kakao.maps.Marker({
position: markerPosition
});
// 마커가 지도 위에 표시되도록 설정합니다
marker.setMap(map);
// 아래 코드는 지도 위의 마커를 제거하는 코드입니다
// marker.setMap(null);
}, (error) => {
alert(error.code);
}, {
maximumAge: 5000,
enableHighAccuracy: true
})
</script>
</body>
</html>