<style>
#map {position: absolute; top: 0; bottom: 0; left: 0; right: 0;}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
var EsriWorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
minZoom: 0,
maxZoom: 20,
});
var OpenStreetMapMapnik = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
minZoom: 0,
maxZoom: 20,
});
// Leaflet layer control
var baseMaps = {
'Landscape': osm,
'Esri Imagery': EsriWorldImagery,
'Mapnik': OpenStreetMapMapnik,
}
L.geoJSON(Building).addTo(map)
L.geoJSON(Boundary).addTo(map)
const searchLayer = L.geoJSON(Location, {
onEachFeature: function(feature, layer){
layer.bindPopup(feature.properties.Name_of_th);
}
}).addTo(map)
L.geoJSON(Recreationals).addTo(map)
L.geoJSON(Road).addTo(map)
L.geoJSON(Water_Body).addTo(map)
var overlayMaps = {
'Location': Location
}
L.control.layers(baseMaps).addTo(map);
L.Control.geocoder().addTo(map);
const searchControl = new L.Control.Search({
layer: searchLayer,
zoom: '20',
propertyName: 'Name_of_th'
})
map.addControl(searchControl);
L.control.locate().addTo(map);
</script>