nocturne
nocturne

Reputation: 647

Deleting google maps heatmap layer

I am writing a google heatMap application and I need to delete the data which heatmap layer contains. Is there some solution? I went trough all stack overflow and can not find the proper solution. Everywhere they advise to do something like this:

heatmap.setMap(null) but this only hides the map, and when I do heatmap.setMap(map) the layer appears again

Upvotes: 1

Views: 367

Answers (2)

Ian Mutawa
Ian Mutawa

Reputation: 503

You can easily just set the data to an empty array

heatmap.setData([])
heatmap.setMap(this.map)

Upvotes: 1

ScaisEdge
ScaisEdge

Reputation: 133370

You can't delete a variable in javascript but you can assign as undefined

 heatmap = undefined;

so heatmap is not a valid object

Upvotes: 1

Related Questions