File size: 3,787 Bytes
fb3c402 |
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 173 174 175 176 |
var mymap = L.map("mapid").setView([12.96, 77.62], 11.5);
L.tileLayer(
"https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw",
{
maxZoom: 18,
attribution:
'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: "mapbox/streets-v11",
tileSize: 512,
zoomOffset: -1
}
).addTo(mymap);
// L.marker([51.5, -0.09]).addTo(mymap)
// .bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
// Circle heatmap
function callThis(value) {
console.log(value);
}
function getColour(value) {
if (value <= 0.1) {
return "#009933";
} else if (value <= 0.2) {
return "#33cc33";
} else if (value <= 0.3) {
return "#99ff99";
} else if (value <= 0.4) {
return "#ccff99";
} else if (value <= 0.5) {
return "#ffff99";
} else if (value <= 0.6) {
return "#ffcc00";
} else if (value <= 0.7) {
return "#ff5050";
} else if (value <= 0.8) {
return "#ff0000";
} else if (value <= 0.9) {
return "#ff0000";
} else {
return "#b30000";
}
}
L.circle([12.93, 77.62], 575 * 4, {
color: "",
fillColor: getColour(0.191),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Kormangala Division");
L.circle([12.91, 77.64], 900 * 1.5, {
color: "",
fillColor: getColour(0.372),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("HSR Layout");
L.circle([12.97, 77.63], 400 * 6, {
color: "",
fillColor: getColour(0.329),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Indiranagar");
L.circle([12.98, 77.59], 500 * 4, {
color: "",
fillColor: getColour(0.426),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Shivajinagar");
L.circle([13.04, 77.59], 600 * 6, {
color: "",
fillColor: getColour(0.392),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Hebbal");
L.circle([12.96, 77.71], 1000 * 6, {
color: "",
fillColor: getColour(0.322),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Whitefield");
L.circle([13.0, 77.57], 850 * 2, {
color: "",
fillColor: getColour(0.5315),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Malleshwaram");
L.circle([12.98, 77.55], 800 * 3, {
color: "",
fillColor: getColour(0.4761),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Rajaji Nagara Division");
L.circle([12.92, 77.57], 900 * 4.5, {
color: "",
fillColor: getColour(0.3272),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Jayanagar");
L.circle([13.05, 77.5], 700 * 4, {
color: "",
fillColor: getColour(0.34),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Jalahalli");
L.circle([12.92, 77.48], 700 * 5, {
color: "",
fillColor: getColour(0.677),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Kengeri Division");
L.circle([12.94, 77.51], 1000 * 3, {
color: "",
fillColor: getColour(0.1676),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("R R NAGAR");
L.circle([12.97, 77.58], 100 * 4, {
color: "",
fillColor: getColour(0.289),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Vidhanasoudha");
L.circle([13.02, 77.52], 1200 * 3, {
color: "",
fillColor: getColour(0.286),
fillOpacity: 0.5
})
.addTo(mymap)
.bindPopup("Peenya Division");
// L.polygon([
// [51.509, -0.08],
// [51.503, -0.06],
// [51.51, -0.047]
// ]).addTo(mymap).bindPopup("I am a polygon.");
// var popup = L.popup();
// function onMapClick(e) {
// popup
// .setLatLng(e.latlng)
// .setContent("You clicked the map at " + e.latlng.toString())
// .openOn(mymap);
// }
// mymap.on("click", onMapClick);
|