Skip to content

Instantly share code, notes, and snippets.

@ubuntufreak
Last active August 29, 2015 13:58
Show Gist options
  • Save ubuntufreak/9950789 to your computer and use it in GitHub Desktop.
Save ubuntufreak/9950789 to your computer and use it in GitHub Desktop.
Adding two L.heatLayer objects to Leaflet map
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.heat demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<style>
#map {
width: 600px;
height: 600px;
}
body {
font: 16px/1.4"Helvetica Neue", Arial, sans-serif;
}
a {
color: #0077ff;
}
</style>
</head>
<body>
<p>Leaflet Heatmap Sample</p>
<div id="map"></div>
<script src="http://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>
<!-- <script src="js/heatmap-points.js"></script> -->
<script>
var addressPoints = [
[28.304380682962783, 3.515625],
[33.7243396617476, 53.0859375],
[34.30714385628804, 35.5078125],
[64.92354174306496, 50.80078125]
];
var addressPoints1 = [
[27.994401411046148, -19.335937499999996],
[-47.04018214480664, -45.3515625],
[-55.17886766328199, -16.5234375],
[-36.597889133070204, -17.9296875],
[-55.27911529201562, -15.468749999999998]
];
var map = L.map('map',{
noWrap: true,
minZoom: 1,
maxZoom: 3,
continuousWorld: true,
reuseTiles: true
}).setView([-20, -20], 1);
var tiles = L.tileLayer('http://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
attribution: '<a href="https://www.mapbox.com/about/maps/">Terms and Feedback</a>',
id: 'examples.map-20v6611k'
}).addTo(map);
var heat = L.heatLayer(addressPoints, {
radius : 25, // default value
blur : 15, // default value
gradient : {1: 'red'} // Values can be set for a scale of 0-1
}).addTo(map);
var heat1 = L.heatLayer(addressPoints1, {
radius : 25, // default value
blur : 15, // default value
gradient : {1: 'blue'} // Values can be set for a scale of 0-1
}).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment