-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleafet.js
85 lines (73 loc) · 2.57 KB
/
leafet.js
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
var map = L.map('map', {
measureControl: true,
}).setView([9.0820, 8.6753], 8);
var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
osm.addTo(map);
//watercolour
var Watercolor = L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.{ext}', {
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
subdomains: 'abcd',
minZoom: 1,
maxZoom: 16,
ext: 'jpg'
});
// Watercolor.addTo(map)
// delorme
var DeLorme = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Copyright: ©2012 DeLorme',
minZoom: 1,
maxZoom: 11
});
// DeLorme.addTo(map)
// googlestreet
var googleStreets = L.tileLayer('http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}', {
maxZoom: 50,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
});
// googleStreets.addTo(map)
// Hybrid
googleHybrid = L.tileLayer('http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
});
// googleHybrid.addTo(map)
// sat
googleSat = L.tileLayer('http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}', {
maxZoom: 20,
subdomains: ['mt0', 'mt1', 'mt2', 'mt3']
});
// googleSat.addTo(map);
// Marker
var singlemarker = L.marker([9.0820, 8.6753], { draggable: true });
var popup = singlemarker.bindPopup('This is Nigeria.' + singlemarker.getLatLng()).openPopup()
popup.addTo(map);
var secondmarker = L.marker([6.5236, 3.6006], { draggable: true });
var popup = secondmarker.bindPopup('This is Lagos.' + secondmarker.getLatLng()).openPopup()
popup.addTo(map);
// layer controls
var Basemaps = {
"OSM": osm,
"DELORME": DeLorme,
"WATERCOLOUR": Watercolor,
"GOOGLESTREET": googleStreets,
"GOOGLE HYBRID": googleHybrid,
"GOOGLESAT": googleSat
};
var overlaymaps = {
"First Marker": singlemarker,
"Second Marker": secondmarker
};
L.control.layers(Basemaps, overlaymaps, { collapsed: true }).addTo(map);
// remove layer
map.removeLayer(osm);
map.removeLayer(singlemarker);
map.removeLayer(secondmarker);
//fullscreenview
var mapid = document.getElementById('map')
function fullScreenview() {
mapid.requestFullscreen();
}
//search control
L.Control.geocoder().addTo(map);