I'm working in a map with about 10 layers and it works fine, when I create a heatmap it becomes slower, that's something I was expecting, because the source has about 2000 points. When I want to make the heatmap disapear I just clear the layer source, but the map continues very slow.

Check out my code:

let map = new ol.Map({
    controls: ol.control.defaults({attribution:false}).extend([
    target: document.getElementById('map'),
    renderer: 'canvas',
    overlays: [overlayPopup],
    layers: layersList,
    view: new ol.View({
     extent: extent, 
     maxZoom: maxZoom, 
     minZoom: minZoom, 
    interactions: ol.interaction.defaults({
        doubleClickZoom: false

let data = new ol.source.Vector();
//I create the heatmap with a empty vector
let heatMapLayer = new ol.layer.Heatmap({
    source: data,
    radius: 10

//To add the source
let coord = ol.proj.fromLonLat([ocor.longitude, ocor.latitude]);  
let lonLat = new ol.geom.Point(coord);
let pointFeature = new ol.Feature({
    geometry: lonLat,
    weight: 20 // e.g. temperature

//and to remove the heatmap:

  • Welcome to GIS SE! As a new user, please be sure to take the tour to learn about this site's focused Q&A format. – Andy Dec 11 '18 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.