forked from Esri/geodev-hackerlabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
63 lines (52 loc) · 1.87 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
<!DOCTYPE html>
<html>
<head>
<title>JS API Unique Value Renderer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.16/esri/css/esri.css">
<style>
html,body,#mapDiv {
padding:0;
margin:0;
height:100%;
}
</style>
<script src="http://js.arcgis.com/3.16compact/"></script>
<script>
var map;
require(["esri/map",
"esri/layers/FeatureLayer",
"esri/symbols/SimpleLineSymbol",
"esri/renderers/UniqueValueRenderer",
"esri/Color",
"dojo/domReady!"],
function(Map,FeatureLayer,SimpleLineSymbol,UniqueValueRenderer,Color) {
map = new Map("mapDiv", {
center: [-122.68, 45.52],
zoom: 10,
basemap: "dark-gray"
});
var renderer = new UniqueValueRenderer(null, "TYPE");
// Green for Type MAX
renderer.addValue("MAX", new SimpleLineSymbol().setColor(new Color([96, 219, 34, 0.8])));
// Yellow for Type SC
renderer.addValue("SC", new SimpleLineSymbol().setColor(new Color([255, 255, 34, 0.8])));
// Red for Type MAX/SC
renderer.addValue("MAX/SC", new SimpleLineSymbol().setColor(new Color([238, 71, 71, 0.8])));
// Light blue for Type CR
renderer.addValue("CR", new SimpleLineSymbol().setColor(new Color([8, 197, 249, 1])).setWidth(4));
var featureLayer = new FeatureLayer("http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/PDX_Rail_Lines/FeatureServer/0",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["TYPE"]
});
featureLayer.setRenderer(renderer);
map.addLayer(featureLayer);
}
);
</script>
</head>
<body>
<div id="mapDiv"></div>
</body>
</html>