-
Notifications
You must be signed in to change notification settings - Fork 0
/
testingSearch.html
172 lines (134 loc) · 5.3 KB
/
testingSearch.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<html>
<head>
<meta charset=utf-8 />
<title>Esri Leaflet Testing Layer Controls</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Load Leaflet from CDN -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw=="
crossorigin=""></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://unpkg.com/[email protected]/dist/esri-leaflet.js"
integrity="sha512-pijLQd2FbV/7+Jwa86Mk3ACxnasfIMzJRrIlVQsuPKPCfUBCDMDUoLiBQRg7dAQY6D1rkmCcR8286hVTn/wlIg=="
crossorigin=""></script>
<!-- Load Esri Leaflet Geocoder from CDN -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/esri-leaflet-geocoder.css"
integrity="sha512-v5YmWLm8KqAAmg5808pETiccEohtt8rPVMGQ1jA6jqkWVydV5Cuz3nJ9fQ7ittSxvuqsvI9RSGfVoKPaAJZ/AQ=="
crossorigin="">
<script src="https://unpkg.com/[email protected]/dist/esri-leaflet-geocoder.js"
integrity="sha512-/jzi62LjYIRhJ4Iv3gE5Trzdz0YrpLVDS5514JDeijbMd9P8uZqad4+4RlyYtpcebB/jnhLUfB0B6dOgMh21gg=="
crossorigin=""></script>
<!-- Include Leaflet.heat via rawgit.com
in production you'd be better off hosting this library yourself -->
<script src="https://rawgit.com/Leaflet/Leaflet.heat/gh-pages/dist/leaflet-heat.js"></script>
<!-- Load Heatmap Feature Layer from CDN -->
<script src="https://unpkg.com/[email protected]"></script>
<div id="map"></div>
<style>
body { margin:0; padding:0; }
#map { position: absolute; top:0; bottom:0; right:0; left:0; }
</style>
</head>
<body>
<script>
var map = L.map('map',{center:[18.342966, -64.817346], zoom: 12, Layers: [Topographic, overlays]});
L.esri.tiledMapLayer({url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer', maxZoom: 20}).addTo(map);
var Topographic = L.esri.basemapLayer("Topographic") , streets = L.esri.basemapLayer('Streets'), Imagery = L.esri.basemapLayer ('Imagery');
var baseLayers = {
"Topographic": Topographic
,"Streets": streets
,"Imagery": Imagery
};
// var FS04 = "https://services8.arcgis.com/kp8l5vAnPTGejwfd/arcgis/rest/services/EHRVI_Public/FeatureServer/0";
// cluster = L.esri.Cluster.featureLayer({
// url: FS04
// });
var FS03 = "https://services8.arcgis.com/kp8l5vAnPTGejwfd/arcgis/rest/services/EHRVI_Public/FeatureServer/0";
heat = L.esri.Heat.featureLayer({
url: FS03,
radius: 30
//,gradient: {
// 0.2: '#ffffb2',
// 0.4: '#fd8d3c',
// 0.6: '#fd8d3c',
// 0.8: '#f03b20',
// 1: '#bd0026'
//}
});
var FS01 = "https://services8.arcgis.com/kp8l5vAnPTGejwfd/arcgis/rest/services/ApplicantsFeaturesService/FeatureServer"; // this is the arcgis online service for the area layers
Points = L.esri.featureLayer({
url: FS01 +'/0',
simplifyFactor: 0.5,
precision: 5,
style: function (feature) {
return {
color: 'blue',
fillColor: 'green',
weight: 2 };
}
});
Points.bindTooltip(function (evt) {
return L.Util.template('<b> Applicant: </b> {EHRVI_ID} ',evt.feature.properties);
});
var FS02 = "https://services8.arcgis.com/kp8l5vAnPTGejwfd/arcgis/rest/services/EHRVI_Public/FeatureServer";
PointsPublic = L.esri.featureLayer({
url: FS02 +'/0',
simplifyFactor: 0.5,
precision: 5,
style: function (feature) {
return {
color: 'blue',
fillColor: 'green',
weight: 2 };
}
});
PointsPublic.bindTooltip(function (evt) {
return L.Util.template('<b> Applicant: </b> {EHRVI_ID} ',evt.feature.properties);
});
var FS02 = "https://services8.arcgis.com/kp8l5vAnPTGejwfd/arcgis/rest/services/EHRVI_Public/FeatureServer";
//https://rpoche.github.io/cluster/vi_leaflet.html
ExactPoints = L.esri.featureLayer({
url: FS02 +'/0',where: "Locator = 'Rooftop'",
style: function (feature) {
return {
color: 'red',
fillColor: 'red' };
}
});
ExactPoints.bindPopup(function (evt) {
return L.Util.template('<a target="_blank" href = "http://maps.google.com/maps?t=h&q=loc:{Lat},{Long}"> <b> Applicant ID: </b> {EHRVI_ID} </a> <p> {DamageAddress}',evt.feature.properties);
});
var overlays = {
"Points Secure": Points
,"Points Public": PointsPublic
// ,"Point Cluster": cluster
,"Exact Locations":ExactPoints
,"Point Heat Map": heat
};
L.control.layers(baseLayers, overlays).addTo(map);
var searchControl = L.esri.Geocoding.geosearch({
providers: [
L.esri.Geocoding.featureLayerProvider({
url: FS02 + '/0/',
searchFields: ['EHRVI_ID','DamageAddress'],
label: 'VI Applicants',
bufferRadius: 75,
formatSuggestion: function(feature){
return feature.properties.EHRVI_ID + ' - ' + feature.properties.DamageAddress ;
}
})
]
}).addTo(map);
var results = L.layerGroup().addTo(map);
searchControl.on('results', function(data){
results.clearLayers();
for (var i = data.results.length - 1; i >= 0; i--) {
results.addLayer(L.marker(data.results[i].latlng));
}
});
</script>
</body>
</html>