forked from Esri/geodev-hackerlabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (63 loc) · 1.9 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
<!DOCTYPE html>
<html>
<head>
<title>JS API Starter App</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%;
}
#searchDiv {
display: block;
position: absolute;
z-index: 3;
top: 20px;
left: 74px;
}
</style>
<script src="http://js.arcgis.com/3.16compact/"></script>
<script>
var map;
require(["esri/map",
"esri/layers/FeatureLayer",
"esri/InfoTemplate",
"esri/dijit/Search",
"dojo/domReady!"],
function(Map,FeatureLayer,InfoTemplate,Search) {
map = new Map("mapDiv", {
center: [-122.68, 45.52],
zoom: 10,
basemap: "dark-gray"
});
var search = new Search({
map: map
}, "searchDiv");
var sources = search.get("sources");
sources.push({
featureLayer: new FeatureLayer("http://services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/PDX_Neighborhoods_Styled/FeatureServer/0"),
name: "Neighborhood Search",
searchFields: ["NAME"],
displayField: "NAME",
exactMatch: false,
outFields: ["NAME","AVGHINC_CY","MEDAGE_CY"],
placeholder: "St. Johns",
enableSuggestions: true,
// Create an InfoTemplate for the popup
infoTemplate: new InfoTemplate("Neighborhood","Name: ${NAME}</br>Avg. Household Income $ ${AVGHINC_CY}</br>Median Age: ${MEDAGE_CY}")
});
search.set("sources",sources);
search.startup();
}
);
</script>
</head>
<body>
<div id="mapDiv"></div>
<!-- ADD new div for the search widget -->
<div id="searchDiv"></div>
</body>
</html>