bukowski bukowski - 1 year ago 166
Javascript Question

Leaflet Weighted Heatmap JavaScript

I'm trying to create a heatmap from a data like ;

var ankara_sincan = L.point(32.5850, 39.9719);
var ankara_dikmen = L.point(32.8406, 39.8964)
var testData = {
max: 8,
data: [{lat: ankara_sincan.x, lng: ankara_sincan.y, weight: 3}, {
lat: ankara_dikmen.x,
lng: ankara_dikmen.y,
weight: 2

I'm using heatmap extension for leaflet in this page .

The problem is ; in document page and in examples a function called HeatMapOverlay is used as shown below ;

var heatmapLayer = new HeatMapOverlay(cfg);

But in my code I get this error ;

Uncaught ReferenceError: HeatMapOverlay is not defined

I've defined sources at the beginning of my code like ;

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" charset="utf-8">
<link rel="stylesheet" href="boge\leaflet.label.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/leaflet.css" />
<script src="/plugins/leaflet-heatmap.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="/build/heatmap.js"></script>
<script src="boge\leaflet-pip.min.js"></script>
<script src="/plugins/leaflet-heatmap.js"></script>

I don't understand why compiler couldn't find my HeatMapOverlay function in predefined locations. Thanks in advance >_<

Answer Source

This is a simple typo. Replace

new HeatMapOverlay(cfg)


new HeatmapOverlay(cfg)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download