mapsapi-heatmap

by Trufi

HTML

<script src="https://maps.api.2gis.ru/2.0/loader.js"></script>
<script src="https://maps.api.2gis.ru/2.0/heat_realworld.js"></script>
<div id="map"></div>

CSS

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
}

JavaScript

const data = [
  [54.97761367069628, 82.90489196777345, 1000],
  [54.97741663850396, 82.88188934326173, 1000],
  [54.97978096099965, 82.89991378784181, 1000],
  [54.98076605428236, 82.89339065551759, 1000],
  [54.86712424019826, 82.47024536132814, 1000],
];

DG
  .then(() => DG.plugin('https://unpkg.com/[email protected]/dist/leaflet-heat.js'))
  .then(() => {
    const map = DG.map('map', {
      center: [54.89, 82.45],
      zoom: 10,
    });

    // first heatmap
    DG.heatLayer(addressPoints1, {
      gradient: {
        0: 'black',
        0.5: 'gray',
        1: 'white'
      },
    }).addTo(map);

    // second heatmap
    DG.heatLayer(data).addTo(map);
  });