-
Notifications
You must be signed in to change notification settings - Fork 1
/
Sample5_style feature layers.html
154 lines (141 loc) · 3.89 KB
/
Sample5_style feature layers.html
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>风格化图层</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.8/esri/css/main.css">
<script src="https://js.arcgis.com/4.8/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"dojo/domReady!"
], function(Map, MapView, FeatureLayer) {
var map = new Map({
basemap:"topo-vector"
});
var view = new MapView({
container: "viewDiv",
map: map,
center: [-118.71511,34.09042],
zoom: 10
});
// 通过图片风格化路口图层
var trailheadsRenderer = {
"type": "simple",
"symbol": {
"type": "picture-marker",
"url": "http://static.arcgis.com/images/Symbols/NPS/npsPictograph_0231b.png",
"width": 10.5,
"height": 10.5
},
visualVariables: [{
type: "size",
field: "ELEV_FT",
valueUnit: "feet",
valueRepresentation: "diameter"
}]
}
var trailheads = new FeatureLayer({
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads/FeatureServer/0",
renderer: trailheadsRenderer
});
map.add(trailheads);
// 通过唯一值风格化小路图层
var trailsRenderer = {
"type": "unique-value",
"field": "USE_BIKE",
"uniqueValueInfos": [
{
"value": "Yes",
"symbol": {
"color": [26, 26, 26, 255],
"width": 0.9,
"type": "simple-line",
"style": "dot"
},
"label": "Bikes"
},
{
"value": "No",
"symbol": {
"color": [230, 0, 0, 255],
"width": 0.9,
"type": "simple-line",
"style": "dot"
},
"label": "No Bikes"
}
]
}
var trails = new FeatureLayer({
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0",
renderer: trailsRenderer
});
map.add(trails,0);
// 通过数值风格化公园和空地层
var openSpacesRender = {
"type": "class-breaks",
"field": "GIS_ACRES",
"classBreakInfos": [
{
"symbol": {
"color": [193, 157, 188, 255],
"outline": {
"width": 0
},
"type": "simple-fill",
"style": "solid"
},
"label": "0 to 1,629",
"minValue": 0,
"maxValue": 1629
},
{
"symbol": {
"color": [203, 216, 162, 255],
"outline":{
"width": 0
},
"type": "simple-fill",
"style": "solid"
},
"label": ">1,629 to 3,754",
"minValue": 1629,
"maxValue": 3754
},
{
"symbol": {
"color": [144, 198, 120, 255],
"outline":{"width": 0},
"type": "simple-fill",
"style": "solid"
},
"label": "> 3,754 to 11,438",
"minValue": 3754,
"maxValue": 11438
}
]
}
var openspaces = new FeatureLayer({
url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space/FeatureServer/0",
renderer: openSpacesRender
});
map.add(openspaces,0);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>