Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김서연
/
Corona_Vaccination_Medical_Institution
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김서연
2021-05-22 23:39:35 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
dcbf7e342dad0a1520561eaa517841e89be65aa5
dcbf7e34
2 parents
14e785a7
63384b1a
merge conflict 처리
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
map/map.html
views/index.ejs
map/map.html
View file @
dcbf7e3
...
...
@@ -2,7 +2,7 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
주소로 장소 표시하기
</title>
<title>
백신 접종 가능기관
</title>
</head>
<body>
...
...
views/index.ejs
View file @
dcbf7e3
...
...
@@ -18,12 +18,12 @@
<div
id=
"map"
style=
"width:700px;height:400px;"
></div>
<script
type=
"text/javascript"
src=
"https://dapi.kakao.com/v2/maps/sdk.js?appkey=35fccf4b4e2a3179187346f26ed3f988&libraries=services"
></script>
<
%
if(typeof(result) != "undefined"){
%>
<
%
if(typeof(result) != "undefined"){
%>
<script>
var
mapContainer
=
document
.
getElementById
(
'map'
),
// 지도를 표시할 div
mapOption
=
{
center
:
new
kakao
.
maps
.
LatLng
(
37.596672
,
127.051950
),
// 지도의 중심좌표
level
:
3
// 지도의 확대 레벨
level
:
5
// 지도의 확대 레벨
};
var
map
=
new
kakao
.
maps
.
Map
(
mapContainer
,
mapOption
);
// 지도를 생성합니다
...
...
@@ -33,20 +33,19 @@
map
.
addControl
(
zoomControl
,
kakao
.
maps
.
ControlPosition
.
RIGHT
);
var
listData
=
"<%= result %>"
;
listData
=
listData
.
replaceAll
(
'"'
,
'\"'
);
listData
=
JSON
.
parse
(
listData
);
// console.log(listData);
//입력되는 배열명이 listData로 들어오면 됨.
listData
.
forEach
(
function
(
addr
,
index
)
{
var
tmpaddr
=
((
addr
.
orgZipaddr
).
split
(
','
))[
0
];
//
console.log(tmpaddr);
console
.
log
(
tmpaddr
);
geocoder
.
addressSearch
(
tmpaddr
,
function
(
result
,
status
)
{
if
(
status
===
kakao
.
maps
.
services
.
Status
.
OK
)
{
var
coords
=
new
kakao
.
maps
.
LatLng
(
result
[
0
].
y
,
result
[
0
].
x
);
// y += result[0].y;
// x += result[0].x;
// count += 1;
var
marker
=
new
kakao
.
maps
.
Marker
({
position
:
coords
,
clickable
:
true
});
...
...
@@ -64,6 +63,8 @@
// 마커 위에 인포윈도우를 표시합니다
infowindow
.
open
(
map
,
marker
);
});
// 지도의 중심을 결과값으로 받은 위치로 이동시킵니다
map
.
setCenter
(
coords
);
}
});
});
...
...
@@ -82,6 +83,7 @@
};
}
</script>
<
%}%>
<
% } %>
</body>
</html>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment