-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasemapControl_optimization.html
More file actions
116 lines (102 loc) · 3.7 KB
/
basemapControl_optimization.html
File metadata and controls
116 lines (102 loc) · 3.7 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link href="https://developer.geon.kr/js/odf/odf.css" rel="stylesheet">
<script type="text/javascript" src="https://developer.geon.kr/js/odf/odf.min.js"></script>
</head>
<body>
<div id="map" class="odf-view" style="height:550px;"></div>
<div>현재 좌표계 : <span id="projection"></span></div>
<div>
※ 배경지도 변경시 좌표계가 변경되면서 콘솔로그에 변경된 좌표계 값이 찍힙니다.
※ 같은 그룹 끼리는 좌표계가 변경되지 않습니다.
</div>
</body>
<script>
/* 맵 타겟 */
var mapContainer = document.getElementById('map');
/* 맵 중심점 */
var coord = new odf.Coordinate(199312.9996,551784.6924);
/* 맵객체 옵션 (외부에서 사용할 때는 proxyURL, proxyParam 옵션이 필요합니다.) */
var mapOption = {
center : coord,
zoom : 11,
projection : 'EPSG:5186',
//proxyURL: 'proxyUrl.jsp',
//proxyParam: 'url',
vWorldURL : 'https://gsapi.geon.kr/map/api/vworld/wmts',
basemap : {
vWorld : ['vWorldBase', 'vWorldWhite', 'vWorldMidnight', 'vWorldHybrid', 'vWorldSatellite'],
},
};
/*
* 배경지도 종류
eMapBasic - 바로e맵 일반 지도
eMapColor - 바로e맵 색각 지도
eMapLowV - 바로e맵 큰글씨 지도
eMapWhite - 바로e맵 백지도
eMapEnglish - 바로e맵 영어 지도
eMapChinese - 바로e맵 중어 지도
eMapJapanese - 바로e맵 일어 지도
eMapWhiteEdu - 바로e맵 교육용 백지도
eMapAIR - 바로e맵 항공지도
* 프록시 사용
proxyURL: 'proxy.jsp' 프록시 설정
*/
/* 맵객체 생성 (외부에서 사용할 때는 proxyURL, proxyParam 옵션이 필요합니다.) */
var map = new odf.Map(mapContainer, {
...mapOption,
//배경지도 최적화 on
optimization: true,
});
/* 베이스맵 컨트롤 생성 */
var basemapControl = new odf.BasemapControl({});
basemapControl.setMap(map);
/* wms 레이어 생성 */
var wmsLayer = odf.LayerFactory.produce('geoserver', {
method : 'get',
server : 'https://geoserver.geon.kr/geoserver',
layer : 'geonpaas:L100000254',
service : 'wms',
});
wmsLayer.setMap(map);
var sld = odf.StyleFactory.produceSLD({
rules : [ {
name : 'My Rule', /*룰 이름*/
symbolizers : [ {
kind : 'Fill',
/*채우기색
rgba 값 입력시 자동변환. 네번째 인수 (투명도) 존재시 fillOpacity 보다 우선 적용됨
*/
color : '#FF9966',
/*채우기 투명도 0~1*/
fillOpacity : 0.7,
/*윤곽선색
rgba 값 입력시 자동변환. 네번째 인수 (투명도) 존재시 outlineOpacity보다 우선 적용됨
*/
outlineColor : '#338866',
/*윤곽선 두께*/
outlineWidth : 2,
}, ],
}, ],
});
//sld 적용
wmsLayer.setSLD(sld);
// wfs 레이어 생성
// LayerFactory의 produce 함수는 option이 다양하니 개발자지원센터 '지도문서'를 확인하세요
var wfsLayer = odf.LayerFactory.produce('geoserver'/*레이어를 생성하기위 한 테이터 호출 방법*/, {
method : 'get',//'post'
server : 'https://geoserver.geon.kr/geoserver', // 레이어가 발행된 서버 주소
layer : 'geonpaas:L100000258', // 발행된 레이어 명칭 (ex. 저장소명:레이어명)
service : 'wfs', // 호출하고자 하는 레이여 형태(wms, wfs, wmts)
}/*레이어 생성을 위한 옵션*/);
wfsLayer.setMap(map);
// 해당 layer가 한눈에 보이는 보여주는 extent로 화면 위치 이동 및 줌 레벨 변경
wfsLayer.fit();
document.querySelector('#projection').innerText =map.getView().getProjection().getCode();
odf.event.addListener(map,'change:view',()=>{
document.querySelector('#projection').innerText =map.getView().getProjection().getCode();
})
</script>
</html>