leaflet-heat

by nettaB

HTML

<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css">
<!DOCTYPE html>
<html>

  <head>
    <title>Leaflet.heat demo</title>
    <!-- <link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
    <script src="https://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>-->
    <style>
      #map {
        width: 800px;
        height: 600px;
      }

      body {
        font: 16px/1.4 "Helvetica Neue", Arial, sans-serif;
      }

      .ghbtns {
        position: relative;
        top: 4px;
        margin-left: 5px;
      }

      a {
        color: #0077ff;
      }

    </style>
  </head>

  <body>

    <p>
      A 10,000-point demo of <a href="https://github.com/Leaflet/Leaflet.heat">Leaflet.heat</a>, a tiny and fast Leaflet heatmap plugin.
      <iframe class="ghbtns" src="https://ghbtns.com/github-btn.html?user=Leaflet&amp;repo=Leaflet.heat&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="90" height="20"></iframe>
    </p>

    <div id="map"></div>

    <script src="https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>

    <script src="https://leaflet.github.io/Leaflet.markercluster/example/realworld.10000.js"></script>

JavaScript

var map = L.map('map').setView([-37.87, 175.475], 12);

var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
}).addTo(map);

addressPoints = addressPoints.map(function(p) {
  return [p[0], p[1]];
});

var heat = L.heatLayer(addressPoints, {
  minOpacity: 0.5,
  radius: 20,
  /*blur: 50, 
  maxZoom: 7,
  max: 4,*/
  gradient: {
    0: "#000000",
    0.2: "#570000",
    0.4: "#ff0000",
    0.6: "#ffc800",
    0.8: "#ffff00",
    1: "#FFFFFF"
  }
}).addTo(map);