-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaflet.html
168 lines (127 loc) · 6.72 KB
/
leaflet.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
<!DOCTYPE html>
<html>
<head>
<title>Geographical Data Visualization</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ==" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet-src.js" integrity="sha512-WXoSHqw/t26DszhdMhOXOkI7qCiv5QWXhH9R7CgvgZMHz1ImlkVQ3uNsiQKu5wwbbxtPzFXd1hK4tzno2VqhpA==" crossorigin=""></script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style>
#map {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
.leaflet-heatmap-layer {
opacity: .55;
}
</style>
<link rel="stylesheet" href="Leaflet.markercluster/dist/MarkerCluster.css" />
<link rel="stylesheet" href="Leaflet.markercluster/dist/MarkerCluster.Default.css" />
<script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster-src.js"></script>
<script src="leaflet-maskcanvas/src/QuadTree.js"></script>
<script src="leaflet-maskcanvas/src/L.GridLayer.MaskCanvas.js"></script>
<script src="Leaflet.heat/dist/leaflet-heat.js"></script>
<script type="text/javascript" src="GeoObs.js"></script>
<script type="text/javascript" src="latlon.js"></script>
<script type="text/javascript" src="heat.js"></script>
</head>
<body>
<div id="map"></div>
<span>Mouse over a cluster to see the bounds of its children and click a cluster to zoom to those bounds</span>
<script type="text/javascript">
var baselayer = L.layerGroup();
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}),
latlng = L.latLng(23.87528, 90.39778);
var CartoDB_DarkMatter = L.tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd',
maxZoom: 19
}), latlng = L.latLng(23.87528, 90.39778);
var Stamen_TonerLines = L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lines/{z}/{x}/{y}{r}.{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: 0,
maxZoom: 20,
ext: 'png'
}),latlng = L.latLng(23.87528, 90.39778);
var Stamen_Terrain = L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}{r}.{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: 0,
maxZoom: 18,
ext: 'png'
});
var Esri_WorldStreetMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
});
var Esri_WorldImagery = 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'
});
var OpenStreetMap_Mapnik = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
var Thunderforest_TransportDark = L.tileLayer('https://{s}.tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png?apikey={apikey}', {
attribution: '© <a href="http://www.thunderforest.com/">Thunderforest</a>, © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
apikey: '597e050f898d4a028039b4538ba78bea',
maxZoom: 22
});
var onemap = L.tileLayer('https://maps-{s}.onemap.sg/v3/Night/{z}/{x}/{y}.png', {
detectRetina: true,
maxZoom: 18,
minZoom: 11,
//Do not remove this attribution
attribution: '<img src="https://docs.onemap.sg/maps/images/oneMap64-01.png" style="height:20px;width:20px;"/> New OneMap | Map data © contributors, <a href="http://SLA.gov.sg">Singapore Land Authority</a>'
});
var canvas = L.canvas();
var map = L.map('map', {center: latlng, zoom: 7, layers: [OpenStreetMap_Mapnik, baselayer], preferCanvas: true});
<!--L.control.scale().addTo(map);-->
var geojson = L.geoJson(geojsonSample, {
style: function (feature) {
return {color: feature.properties.color};
},
onEachFeature: function (feature, layer) {
var popupText = 'Cell name: ' + feature.properties.cellname+ '<br>' +
'Lat: ' + feature.properties.lat +'<br>' +
'District: ' + feature.properties.district;
layer.bindPopup(popupText);
}
});
var geojsonMarkerOptions = {
radius: .5,
fillColor: function(feature){return feature.properties.color},
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
};
function getColor(d) {
switch (d) {
case '2G':
return '#FF0E15'; <!--FF122D 3AFF6C-->
case '3G':
return '#32DFFF';
case '4G':
return '#923DFF';
}
}
var canvaslayer= L.geoJSON(geojsonSample, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {radius:.5, stroke:true, fillColor: getColor(feature.properties.sitetype),color: getColor(feature.properties.sitetype), weight: 1,opacity: .25,fillOpacity: 0.8, renderer: canvas });
}
});
var markers = L.markerClusterGroup();
map.addLayer(markers);
heat = heat.map(function (p) { return [p[0], p[1]]; });
var geoheatlayer = L.heatLayer(heat, {minOpacity : .01,radius: 25, max: .25})
L.control.layers({'Light':baselayer,'Night':onemap, 'Dark': CartoDB_DarkMatter, 'TRDark': Thunderforest_TransportDark, 'Natural': Esri_WorldImagery}, {'Canvas':canvaslayer, 'Heatmap': geoheatlayer}).addTo(map);
</script>
</body>
</html>