-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleFunctionStyle.html
More file actions
98 lines (93 loc) · 2.34 KB
/
simpleFunctionStyle.html
File metadata and controls
98 lines (93 loc) · 2.34 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
<!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>
<p>마우스 휠을 이용하여 줌 레벨을 변경해보세요</p>
</body>
<script>
/* 맵객체 생성 (외부에서 사용할 때는 proxyURL, proxyParam 옵션이 필요합니다.) */
var mapContainer = document.getElementById('map');
var coord = new odf.Coordinate(199312.9996,551784.6924);
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'],
},
};
var map = new odf.Map(mapContainer, mapOption);
/*면 레이어 추가*/
var polygonLayer = odf.LayerFactory.produce('geoserver', {
method : 'get',
server : 'https://geoserver.geon.kr/geoserver',
layer : 'geonpaas:L100000254',
service : 'wfs',
});
polygonLayer.setMap(map);
polygonLayer.fit();
/*폴리곤 스타일 생성*/
var functionStyle = odf.StyleFactory.produceFunction([ {
seperatorFunc : "default",
style : {
fill : {
color : [ 255, 100, 0, 0.5 ]
},//채우기
stroke : {
color : 'red',
width : 3,
},//윤곽선
text : {
font : 'bold 20px Courier New',
fill : {
color : 'red'
},
}
},
callbackFunc : function(style, feature, resolution) {
style.getText().setText(String(feature.getProperties()['DGM_NM']));
},
},
//resolution 값이 1보다 클때 적용되는 스타일
{
seperatorFunc : function(feature, resolution) {
return resolution > 1;
},
style : {
fill : {
color : [ 0, 255, 100, 0.5 ]
},//채우기
stroke : {
color : 'green',
width : 3,
},//윤곽선
},
priority : 2,
},
//resolution 값이 3보다 클때 적용되는 스타일
{
seperatorFunc : function(feature, resolution) {
return resolution > 3;
},
style : {
fill : {
color : [ 0, 100, 255, 0.5 ]
},//채우기
stroke : {
color : 'blue',
width : 3,
},//윤곽선
},
priority : 1,
} ]);
polygonLayer.setStyle(functionStyle);
</script>
</html>