-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
129 lines (115 loc) · 3.19 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/>
<title>Arcade Labels</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css"/>
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script type="text/plain" id="amenities">
var i = 0;
var features = [];
if ($feature.TastingRoo != " ") {
features[i++] = "-Tasting Room Onsite";
}
if ($feature.GroupTour != " ") {
features[i++] = "-Tours Available";
}
if ($feature.PicnicArea != " ") {
features[i++] = "-Picnic Area Onsite";
}
if ($feature.FoodAvaila != " ") {
features[i++] = "-Food Available Onsite";
}
return Concatenate(features, TextFormatting.NewLine)
</script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/geometry/Extent"
], function(Map, MapView, FeatureLayer, Extent) {
var minScale = 100000;
var map = new Map({
basemap: "gray-vector",
})
var extent = new Extent ({
xmin: -83.7,
ymin: 36.4,
xmax: -75.7,
ymax: 39.6
})
var view = new MapView({
container: "viewDiv",
map: map,
extent: extent
});
var nameClass = {
labelPlacement: "above-right",
labelExpressionInfo: {
expression: "$feature.NAME"
},
minScale: minScale
};
nameClass.symbol = createTextSymbol("black");
var amenitiesArcade = document.getElementById("amenities").text;
var amenitiesClass = {
labelExpressionInfo: {
expression: amenitiesArcade
},
labelPlacement: "below-right",
minScale: minScale
};
amenitiesClass.symbol = createTextSymbol("#3ba53f");
var serviceUrl =
"https://services5.arcgis.com/cMBqYE4wmbXNMvex/ArcGIS/rest/services/Virginia_Wineries/FeatureServer/1";
var layer = new FeatureLayer({
url: serviceUrl,
renderer: {
type: "simple",
symbol: {
type: "simple-marker",
color: [128, 0, 128, 0.6],
size: 10,
outline: {
color: [0, 0, 0, 0.4],
width: 0.5
}
}
},
labelingInfo: [
nameClass,
amenitiesClass
]
});
view.map.add(layer);
function createTextSymbol(color) {
return {
type: "text", // autocasts as new TextSymbol()
font: {
size: 12,
weight: "bold"
},
color: "white",
haloColor: color,
haloSize: 1
};
}
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>