Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.style("opacity", this.opacity());
const columns = this.columns();
const latIdx = this.latitudeColumn_exists() ? columns.indexOf(this.latitudeColumn()) : 0;
const longIdx = this.longitudeColumn_exists() ? columns.indexOf(this.longitudeColumn()) : 1;
const weightIdx = columns.indexOf(this.weightColumn());
this.clear();
let bounds: LatLngBounds;
const data = this.data().filter(row => !this.omitNullLatLong() || (!!row[latIdx] && !!row[longIdx])).map(row => {
if (!bounds) {
bounds = new LatLngBounds([row[latIdx], row[longIdx]]);
} else {
bounds.extend([row[latIdx], row[longIdx]]);
}
return [row[latIdx], row[longIdx], this.weightColumn_exists() ? row[weightIdx] : 0.5];
});
const heat = new LHeatLayer(data, {
minOpacity: this.minOpacity(),
max: this.max(),
radius: this.radius(),
blur: this.blur(),
gradient: this.gradient() as any
});
(heat as any).getBounds = () => {
return bounds;
};
this.add(heat);
}
}