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

  • SEARCH
  • Home
  • 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 8196183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:23:55+00:00 2026-06-07T05:23:55+00:00

I am currently trying to generate a heatmap overlay to Google Maps by using

  • 0

I am currently trying to generate a heatmap overlay to Google Maps by using heatmap.py. The site describing heatmap.py (http://jjguy.com/heatmap/) shows a picture of a beautiful heatmap over Washington D.C. and the code used to generate it. After running the code, however, I get the following KML output:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Folder>
    <GroundOverlay>
      <Icon>
        <href>classic.png</href>
      </Icon>
      <LatLonBox>
        <north>38.9096822126249293</north>
        <south>38.8880342183292171</south>
        <east>-77.0127326291108432</east>
        <west>-77.0498038539626435</west>
        <rotation>0</rotation>
      </LatLonBox>
    </GroundOverlay>
  </Folder>
</kml>

This is just a rectangular box. Moreover, I investigated the source code and found the following:

KML = """<?xml version="1.0" encoding="UTF-8"?>                                                                                                                        
<kml xmlns="http://www.opengis.net/kml/2.2">                                                                                                                           
  <Folder>                                                                                                                                                             
    <GroundOverlay>                                                                                                                                                    
      <Icon>                                                                                                                                                           
        <href>%s</href>                                                                                                                                                
      </Icon>                                                                                                                                                          
      <LatLonBox>                                                                                                                                                      
        <north>%2.16f</north>                                                                                                                                          
        <south>%2.16f</south>                                                                                                                                          
        <east>%2.16f</east>                                                                                                                                            
        <west>%2.16f</west>                                                                                                                                            
        <rotation>0</rotation>   
    <GroundOverlay>                                                                                                                                                    
      <Icon>                                                                                                                                                           
        <href>%s</href>                                                                                                                                                
      </Icon>                                                                                                                                                          
      <LatLonBox>                                                                                                                                                      
        <north>%2.16f</north>                                                                                                                                          
        <south>%2.16f</south>                                                                                                                                          
        <east>%2.16f</east>                                                                                                                                            
        <west>%2.16f</west>                                                                                                                                            
        <rotation>0</rotation>                                                                                                                                         
      </LatLonBox>                                                                                                                                                     
    </GroundOverlay>                                                                                                                                                   
  </Folder>                                                                                                                                                            
</kml>"""

def saveKML(self, kmlFile):
    """                                                                                                                                                            
    Saves a KML template to use with google earth.  Assumes x/y coordinates                                                                                        
    are lat/long, and creates an overlay to display the heatmap within Google                                                                                      
    Earth.                                                                                                                                                         

    kmlFile ->  output filename for the KML.                                                                                                                       
    """

    tilePath = os.path.basename(self.imageFile)
    north = self.maxXY[1]
    south = self.minXY[1]
    east = self.maxXY[0]
    west = self.minXY[0]

    bytes = KML % (tilePath, north, south, east, west)
    file(kmlFile, "w").write(bytes)

Which seems to do exactly what the output suggests. Has anyone been able to generate a heatmap similar to the pictured one using heatmap.py. If not, have you been able to generate a similar heatmap using another method? Thanks.

  • 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-07T05:23:56+00:00Added an answer on June 7, 2026 at 5:23 am

    That is not “just a rectangular box”. That’s exactly how overlays are defined in KML. The Google documentations reports this example:

    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
    <GroundOverlay>
       <name>GroundOverlay.kml</name>
       <color>7fffffff</color>
       <drawOrder>1</drawOrder>
       <Icon>
          <href>http://www.google.com/intl/en/images/logo.gif</href>
          <refreshMode>onInterval</refreshMode>
          <refreshInterval>86400</refreshInterval>
          <viewBoundScale>0.75</viewBoundScale>
       </Icon>
       <LatLonBox>
          <north>37.83234</north>
          <south>37.832122</south>
          <east>-122.373033</east>
          <west>-122.373724</west>
          <rotation>45</rotation>
       </LatLonBox>
    </GroundOverlay>
    </kml>
    

    You can save it as kml file and check that it works. The main difference compared to the code in your question is the <color> tag: this example uses the alpha channel to reduce the opacity of the image. The <Icon> section contains a reference to the image to show, the <LatLonBox> contains the coordinates of the image.

    Check the google documentation about GroundOverlay for more details.

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

Sidebar

Related Questions

I am currently trying to dynamically generate Javascript using a Scala object in my
I am currently trying to generate the creation SQL for my tables based off
I am trying to generate a hierarchical directory listing in pyGTK. Currently, I have
currently i'm trying to use imagick to generate some images without saving them on
Im trying to generate a color gradient using ColdFusion. My current code below works
Currently trying at add ajax to a site, after much reading I discovered that
Currently I'm trying to automatically generate a create script for all my SQL jobs
I am trying to generate 8 screenshots for an uploaded video using FFMPEG. I
Currently trying to come up with a best practice for a ZF site that
I am currently trying to create a REST web service for my django site

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.