Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최현영
/
Expresswayinfo24
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
4
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
최현영
2020-06-04 18:10:53 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2a087a69fe6fdabfddaebe8116a6239d3e923803
2a087a69
1 parent
1f920c2a
Highway number function added
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
66 deletions
whereur/app.js
whereur/public/maprealtime.html
whereur/app.js
View file @
2a087a6
...
...
@@ -127,6 +127,17 @@ function typeforecast(typetext){
else
false
;
}
function
isroadnumber
(
typetext
){
if
(
typetext
==
'노선정보'
){
return
true
;
}
else
{
return
false
;
}
}
app
.
post
(
'/hook'
,
function
(
req
,
res
)
{
//console.log(jsonForforecast);
...
...
@@ -134,6 +145,7 @@ app.post('/hook', function (req, res) {
var
isstart
;
var
isforecast
;
var
isselecttypeforecast
;
var
isfindroad
;
var
istypeforecast
;
var
eventObj
=
req
.
body
.
events
[
0
];
var
source
=
eventObj
.
source
;
...
...
@@ -153,6 +165,12 @@ app.post('/hook', function (req, res) {
helloworld
(
eventObj
);
}
isfindroad
=
isroadnumber
(
message
.
text
);
if
(
isfindroad
==
true
){
console
.
log
(
"노선번호를 궁금해 합니다."
)
roadnumber
(
eventObj
);
}
isforecast
=
firstforecast
(
message
.
text
);
if
(
isforecast
){
if
(
message
.
text
==
'1'
){
...
...
@@ -163,6 +181,10 @@ app.post('/hook', function (req, res) {
console
.
log
(
'[request Order] '
,
message
);
viewhtml
(
eventObj
);
}
else
if
(
message
.
text
==
'3'
){
console
.
log
(
'[request Order] '
,
message
);
//tieupselect(eventObj);
}
}
isselecttypeforecast
=
selecttypeforecast
(
message
.
text
);
...
...
@@ -220,7 +242,7 @@ function helloworld(eventObj){
},
{
"type"
:
"text"
,
"text"
:
"현재 교통 예보가 궁금하시다면 1번을, 실시간 교통혼잡 상황을 보실려면 2번을
눌러주세요
"
"text"
:
"현재 교통 예보가 궁금하시다면 1번을, 실시간 교통혼잡 상황을 보실려면 2번을
, 실시간 정체상황을 알고 싶다면 3번을 눌러주세요. 노선정보는 '노선정보'를 입력해주세요.
"
}
]
}
...
...
@@ -241,11 +263,11 @@ function viewhtml(eventObj){
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"실시간 교통상황 웹페이지로 안내합니다."
"text"
:
"실시간
전국 국도 및 고속국도
교통상황 웹페이지로 안내합니다."
},
{
"type"
:
"text"
,
"text"
:
"http
s://www.chyoss.tk:23023
/public/maprealtime.html"
"text"
:
"http
://www.chyoss.tk:24024
/public/maprealtime.html"
}
]
}
...
...
@@ -548,6 +570,42 @@ function normalforecasttoG(eventObj){
}
function
roadnumber
(
eventObj
){
request
.
post
(
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
},
json
:
{
"replyToken"
:
eventObj
.
replyToken
,
"messages"
:[
{
"type"
:
"text"
,
"text"
:
"고속도로 노선 번호는 다음과 같습니다."
},
{
"type"
:
"text"
,
"text"
:
"경부 및 남북 구간: 1-경부선, 15-서해안선, 17-평택파주선, 25-호남 및 논산천안선, 27-순천완주선, 29-세종포천지선, 35-통영대전 및 중부선, 37-제2중부선, 45-중부내륙선, 55-중앙선, 65-동해선"
},
{
"type"
:
"text"
,
"text"
:
"동서 구간 : 10-남해, 12-무안광주 및 광주대구선, 16-울산선, 20-새만금포항선, 30-당진영덕선, 32-아산청주선, 40-평택제천선, 50-영동선, 52-광주원주선, 60-서울양양선"
},
{
"type"
:
"text"
,
"text"
:
"순환 및 경인 구간: 100-서울외각순환선, 300-대전남부선, 400-수도권제2순환, 600-부산외곽순환선, 110-제2 경인선, 120-경인선, 130-인천공항선"
},
{
"type"
:
"text"
,
"text"
:
"지선 구간: 102-남해 제1지선, 104-남해 제2지선, 105-남해 제3지선, 151-서천공주선, 153-평택시흥선, 171-오산화성 및 용인서울선, 204-새만금포항지선2, 251-호남지선, 253-고참담양선, 301-상주영천선, 451-중부내륙지선, 551-중앙지선"
}
]
}
},(
error
,
response
,
body
)
=>
{
console
.
log
(
body
)
});
}
// var url1 = 'http://data.ex.co.kr/openapi/odtraffic/trafficAmountByCongest';
// var queryParams1 = '?' + encodeURIComponent('key') + '=4365330273'; /* Service Key*/
...
...
@@ -635,6 +693,13 @@ try {
HTTPS
.
createServer
(
option
,
app
).
listen
(
sslport
,
()
=>
{
console
.
log
(
`[HTTPS] Server is started on port
${
sslport
}
`
);
});
var
server
=
app
.
listen
(
24024
,
function
()
{
var
host
=
server
.
address
().
address
var
port
=
server
.
address
().
port
console
.
log
(
"Example app listening at http://%s:%s"
,
host
,
port
)
});
}
catch
(
error
)
{
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
...
...
whereur/public/maprealtime.html
View file @
2a087a6
...
...
@@ -26,18 +26,6 @@
var
POPUP_LAYERS
=
[];
var
EPSG_4326
=
new
OpenLayers
.
Projection
(
'EPSG:4326'
);
var
EPSG_900913
=
new
OpenLayers
.
Projection
(
'EPSG:900913'
);
function
getCORSURL
(
uri
,
type
)
{
var
yqlUri
=
'http://query.yahooapis.com/v1/public/yql?q='
+
encodeURIComponent
(
'SELECT * FROM '
+
type
+
' where url="'
+
uri
+
'"'
);
if
(
type
==
'html'
)
{
yqlUri
+=
encodeURIComponent
(
' and xpath="/*"'
);
}
else
if
(
type
==
'json'
)
{
yqlUri
+=
"&callback=&format=json"
;
}
else
if
(
type
==
'xml'
)
{
yqlUri
+=
"&format=xml"
;
}
return
yqlUri
;
}
</script>
<script
type=
"text/javascript"
src=
"http://openapi.its.go.kr/javascript/openapi.ntic.js"
></script>
<script
type=
"text/javascript"
>
...
...
@@ -79,58 +67,7 @@
// 교통정보 종료
map
.
addLayers
(
NOPOP_LAYERS
);
map
.
addLayers
(
POPUP_LAYERS
);
// 아이콘 클릭시 팝업 설정 시작
var
controlSelect
=
new
OpenLayers
.
Control
.
SelectFeature
(
POPUP_LAYERS
,
{
clickout
:
true
,
toggle
:
false
,
multiple
:
false
,
onSelect
:
function
(
feature
){
var
data
=
feature
.
data
;
var
message
=
''
;
switch
(
feature
.
layer
.
id
)
{
case
'weatherLayer'
:
message
+=
weather
.
getMessage
(
data
);
break
;
case
'constructionLayer'
:
message
+=
construction
.
getMessage
(
data
);
break
;
case
'accidentLayer'
:
message
+=
accident
.
getMessage
(
data
);
break
;
case
'cctvLayer'
:
message
+=
cctv
.
getMessage
(
data
);
break
;
case
'warningLayer'
:
message
+=
warning
.
getMessage
(
data
);
break
;
case
'tourLayer'
:
message
+=
tour
.
getMessage
(
data
);
break
;
default
:
return
false
;
}
var
selectedFeature
=
feature
;
var
popup
=
new
OpenLayers
.
Popup
.
FramedCloud
(
"popup"
,
feature
.
geometry
.
getBounds
().
getCenterLonLat
(),
null
,
message
,
null
,
true
,
function
(
e
){
controlSelect
.
unselect
(
selectedFeature
);});
popup
.
minSize
=
new
OpenLayers
.
Size
(
200
,
200
);
popup
.
maxSize
=
new
OpenLayers
.
Size
(
400
,
400
);
feature
.
popup
=
popup
;
map
.
addPopup
(
popup
);
},
onUnselect
:
function
(
feature
){
map
.
removePopup
(
feature
.
popup
);
feature
.
popup
.
destroy
();
feature
.
popup
=
null
;
}
});
map
.
addControls
([
controlSelect
]);
controlSelect
.
activate
();
// 아이콘 클릭시 팝업 설정 종료
}
</script>
</body>
</html>
-->
...
...
Please
register
or
login
to post a comment