forked from Esri/esri-leaflet-geocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
65 lines (57 loc) · 2.04 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
<!DOCTYPE html>
<html>
<head>
<title>Esri Leaflet Geocoder</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<!-- Load Leaflet from their CDN -->
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css" />
<script src="/node_modules/leaflet/dist/leaflet-src.js"></script>
<script src="/node_modules/esri-leaflet/dist/esri-leaflet.js"></script>
<!-- Make the map fill the entire page -->
<style>
#map {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
<script src="/dist/esri-leaflet-geocoder.js"></script>
<link rel="stylesheet" href="/dist/esri-leaflet-geocoder.css" />
<style>
#test {
position: fixed;
top: 0px;
right: 0px;
z-index: 100;
}
</style>
</head>
<body>
<div id="test"></div>
<div id="map"></div>
<a href="https://github.com/Esri/esri-leaflet-geocoder"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
<script>
var map = L.map('map').setView([37.74, -121.62], 9);
var tiles = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
var searchControl = L.esri.Geocoding.Controls.geosearch({
providers: [
L.esri.Geocoding.Providers.geocodeServiceProvider(),
L.esri.Geocoding.Providers.featureLayerProvider({
url: '//services.arcgis.com/uCXeTVveQzP4IIcx/arcgis/rest/services/gisday/FeatureServer/0/',
searchFields: ['Name', 'Organization'],
label: 'GIS Day Events',
bufferRadius: 20000,
formatSuggestion: function(feature){
return feature.properties.Name + ' - ' + feature.properties.Organization;
}
})
]
}).addTo(map);
searchControl.on('results', function(e){
console.log(e);
});
</script>
</body>
</html>