Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:33:17+00:00 2026-06-17T01:33:17+00:00

I am trying to create a heat map using Google Maps API. I am

  • 0

I am trying to create a heat map using Google Maps API. I am getting the map but not the heat values on the co-ordinates. Given below ids the code:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map_canvas { height: 100% }
    </style>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=APIKEY&sensor=true">
      
    </script>
    <script type="text/javascript">

   function initialize() {
  var mapOptions = {
    zoom: 3,
    center: new google.maps.LatLng(8.881928, 76.592758),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
}

function loadScript() {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src = "http://maps.googleapis.com/maps/api/js?key=APIKEY&sensor=true&callback=initialize";
  document.body.appendChild(script);
}
window.onload = loadScript;
 </script>

<script>
var heatMapData = [
  {location: new google.maps.LatLng(8.8678, 76.5623 },
  {location: new google.maps.LatLng(9.5674, 77.5623)},
  {location: new google.maps.LatLng(10.7821, 78.447)},
  {location: new google.maps.LatLng(12.4523, 79.443)},
  {location: new google.maps.LatLng(37.782, -122.441)},
  {location: new google.maps.LatLng(37.782, -122.439)},
  {location: new google.maps.LatLng(37.782, -122.435)},
  {location: new google.maps.LatLng(37.785, -122.447)},
  {location: new google.maps.LatLng(37.785, -122.445)},
  {location: new google.maps.LatLng(37.785, -122.441)},
  {location: new google.maps.LatLng(37.785, -122.437)},
  {location: new google.maps.LatLng(37.785, -122.435)}
];
  
var heatmap = new google.maps.visualization.HeatmapLayer({
  data: heatMapData
});
heatmap.setOptions({radius: heatmap.get('20')});
heatmap.setMap(map);

</script>
  </head>
  <body onload="initialize()">
    <div id="map_canvas" style="width:100%; height:100%"></div>
  </body>
</html>

This is the screenshot of the output. Could anyone help me in this?

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:33:18+00:00Added an answer on June 17, 2026 at 1:33 am

    According to the Google Maps API documentation, you should be passing an array of google.maps.LatLng objects to the HeatmapLayer as data.

    Try this:

    var heatMapData = [
        new google.maps.LatLng(8.8678, 76.5623),
        new google.maps.LatLng(9.5674, 77.5623),
        new google.maps.LatLng(10.7821, 78.447),
        new google.maps.LatLng(12.4523, 79.443),
        new google.maps.LatLng(37.782, -122.441),
        new google.maps.LatLng(37.782, -122.439),
        new google.maps.LatLng(37.782, -122.435),
        new google.maps.LatLng(37.785, -122.447),
        new google.maps.LatLng(37.785, -122.445),
        new google.maps.LatLng(37.785, -122.441),
        new google.maps.LatLng(37.785, -122.437),
        new google.maps.LatLng(37.785, -122.435)
    ];
    

    Also, you need to load the google.maps.visualization library by adding &libraries=visualization to the end of the URL when you include the Google Maps API.

    Working example: http://jsfiddle.net/EBQQH/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an MSI for my project using WIX. I've got HEAT
I am currently trying to generate a heatmap overlay to Google Maps by using
Trying to create an array of structs (new to C), but I am getting
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create a black line in my view to separate text blocks but
Trying to create a new Dedicated Cache Role in Windows Azure but get the
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
Trying to create a background-image slideshow and am getting this error... This is the
I'm trying create a RCP Application with Eclipse, but I can't get past the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.