[GIS] Get the inverse of default heat map gradient in Google Maps Javascript API

google mapsheat mapjavascript

In Google Maps Javascript API for heat maps the default gradient displays red color in areas of higher density and changes to red as intensity decreases. In my application I need to show areas of higher intensity in green and lower intensity in red. I tried printing the default gradient values heatmap.get('gradient') only to get 'undefined' value. How can I get the default value of Google Maps API heat map gadient.

Best Answer

For anyone who needs it, here's the default gradient:

["rgba(102, 255, 0, 0)",
"rgba(102, 255, 0, 1)",
"rgba(147, 255, 0, 1)",
"rgba(193, 255, 0, 1)",
"rgba(238, 255, 0, 1)",
"rgba(244, 227, 0, 1)",
"rgba(249, 198, 0, 1)",
"rgba(255, 170, 0, 1)",
"rgba(255, 113, 0, 1)",
"rgba(255, 57, 0, 1)",
"rgba(255, 0, 0, 1)"]
Related Question