2
votes

Here is my github gist which describes my problem:

https://gist.github.com/saxena-gaurav/516fb24d2d11d1243adf

In the initialization phase, I am setting the dataPoints array to empty. Upon the success of ajax call, I hard-code the dataPoints array to some values. I added the watcher which then calls the helper function to update the 'layers overlays data' object. Inspite of this, I do not see the data getting rendered on the map.

Any suggestions please to see what I am doing wrong ?

I am using the below link as a reference example: https://github.com/tombatossals/angular-leaflet-directive/blob/master/examples/heatmap-example.html

1

1 Answers

0
votes

Try this after your data updates.

leafletData.getMap().then(function (map) {
  map.eachLayer(function (layer) {
    if (layer.options.layerName == 'heatmap') {
       layer.setLatLngs(newHeatmapData);
    }
  })
})