forked from swaggyPYang/arcgisapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfonts.html
108 lines (93 loc) · 2.56 KB
/
fonts.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Add labels to a FeatureLayer - 4.8</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.8/esri/themes/light-green/main.css">
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
background-color: black;
}
</style>
<script>
var dojoConfig = {
has: {
"esri-featurelayer-webgl": 1
}
}
</script>
<script src="https://js.arcgis.com/4.8/"></script>
<script>
require([
"esri/WebMap",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/widgets/Search",
"esri/config",
"dojo/domReady!"
], function(WebMap, MapView, FeatureLayer, Search,esriConfig) {
esriConfig.fontsUrl = "https://swaggypyang.github.io/arcgisapi/fonts";
const labelClass = { // autocasts as new LabelClass()
symbol: {
type: "text", // autocasts as new TextSymbol()
color: "green",
haloColor: "black",
font: { // autocast as new Font()
family: "lisu",
size: 12,
weight: "Regular"
}
},
labelPlacement: "above-center",
labelExpressionInfo: {
expression: "$feature.MARKER_ACTIVITY"
}
};
const view = new MapView({
container: "viewDiv",
map: new WebMap({
portalItem: { // autocasts as new PortalItem
id: "372b7caa8fe340b0a6300df93ef18a7e"
},
layers: [
new FeatureLayer({
portalItem: { // autocasts as new PortalItem
id: "6012738cd1c74582a5f98ea30ae9876f"
},
labelingInfo: [labelClass],
renderer: {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: "rgba(0,100,0,0.6)",
size: 3,
outline: {
color: [0, 0, 0, 0.1],
width: 0.5
}
}
}
})
]
}),
center: [-116.9250, 34.2501],
zoom: 14
});
// Adds the search widget to the top right corner of the view
view.ui.add(new Search({
view: view
}), "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>