Toggle navigation
Toggle navigation
This project
Loading...
Sign in
윤규리
/
emergency_room_ChatBot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김시환
2022-11-21 19:27:12 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3c601a877a45076d1bea9f6a615d6cf5cd5dc046
3c601a87
2 parents
b555c5f3
7a0c06cf
Merge branch 'main' into 'main'
misc. + getXY See merge request !7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
Address.js
Address.js
View file @
3c601a8
...
...
@@ -46,9 +46,47 @@ function selectAddress(addressArray, number) {
// hospitals: array from hospital API
// addNum: index of addressArray
function
getXY
(
hospitals
,
addNum
)
{
function
getXY
(
hospitals
,
addNum
)
{
var
hospitals_xy
=
new
Array
();
hospitals_xy
.
my_x
=
AddressList
[
addNum
].
road_address
.
x
;
hospitals_xy
.
my_y
=
AddressList
[
addNum
].
road_address
.
y
;
// hopsitals_keyword[i] : name, x, y
for
(
let
i
=
0
;
i
<
hospitals
.
length
;
i
++
)
{
// iterate through available hospitals...
fetch
(
'https://dapi.kakao.com/v2/local/search/keyword.json?'
+
new
URLSearchParams
({
query
:
hospitals
.
name
,
category_group_code
:
"HP8"
}),
{
method
:
"GET"
,
headers
:
{
"Authorization"
:
"KakaoAK c14234ba46c574c73715276c5644f397"
}
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
for
(
let
j
=
0
;
j
<
data
.
length
;
j
++
)
{
if
((
data
.
documents
[
j
].
category_name
===
"의료,건강 > 병원 > 종합병원"
)
||
(
data
.
documents
[
j
].
category_name
===
"의료,건강 > 병원 > 대학병원"
))
{
hospitals_xy
[
i
].
name
=
data
.
documents
[
j
].
place_name
;
hospitals_xy
[
i
].
x
=
data
.
documents
[
j
].
x
;
hospitals_xy
[
i
].
y
=
data
.
documents
[
j
].
y
;
break
;
}
}
})
}
AddressList
=
null
;
return
hospitals_xy
;
/*
hospitals_xy:
.my_x, .my_y: user's coordinates (to some precision..)
[i].name: name of ith hospital
[i].x, [i].y: coordinates of ith hospital
*/
// for loop 다 돈 다음에 return하도록 수정해야함 (하실수 있는분?)
}
module
.
exports
=
{
getAddress
,
getXY
};
\ No newline at end of file
...
...
Please
register
or
login
to post a comment