building the overlay images

17 views
Skip to first unread message

bnw

unread,
May 27, 2010, 3:01:17 PM5/27/10
to gheat
So I managed to get python/aspen/gheat working on xp.

My question is how I am meant to generate these pretty images from my
map data?

My data is currently in xml. I can get it to read in google maps.
From what I can gather I need to turn the lat lng coordinates into
image coordinates. I have no idea how to do this. Any hints? Thanks.

Chad Whitacre

unread,
May 27, 2010, 4:48:46 PM5/27/10
to gh...@googlegroups.com
Byron,

You need to dump your lat/lng data from XML to the CSV format described here:


Then run that db.py script to load your data into gheat's SQLite database.


chad




--
You received this message because you are subscribed to the Google Groups "gheat" group.
To post to this group, send email to gh...@googlegroups.com.
To unsubscribe from this group, send email to gheat+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gheat?hl=en.


bnw

unread,
May 27, 2010, 11:55:34 PM5/27/10
to gheat
Thanks! I will give it a shot. And I just figured out how to get the
data out of SQL express *facepalm*

On May 27, 3:48 pm, Chad Whitacre <c...@zetaweb.com> wrote:
> Byron,
>
> You need to dump your lat/lng data from XML to the CSV format described
> here:
>
>    http://www.zetadev.com/software/gheat/0.2/__/doc/html/db.py.html
>
> <http://www.zetadev.com/software/gheat/0.2/__/doc/html/db.py.html>Then run
> that db.py script to load your data into gheat's SQLite database.
>
> chad
>
> On Thu, May 27, 2010 at 3:01 PM, bnw <byron.we...@gmail.com> wrote:
> > So I managed to get python/aspen/gheat working on xp.
>
> > My question is how I am meant to generate these pretty images from my
> > map data?
>
> > My data is currently in xml.  I can get it to read in google maps.
> > From what I can gather I need to turn the lat lng coordinates into
> > image coordinates.  I have no idea how to do this.  Any hints?  Thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "gheat" group.
> > To post to this group, send email to gh...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > gheat+un...@googlegroups.com <gheat%2Bunsu...@googlegroups.com>.

bnw

unread,
May 28, 2010, 1:46:27 PM5/28/10
to gheat
It's working O_O

Chad Whitacre

unread,
May 28, 2010, 1:54:13 PM5/28/10
to gh...@googlegroups.com
Yay! :)

Let me know if you have a public URL I can link to.


chad



It's working O_O
To unsubscribe from this group, send email to gheat+un...@googlegroups.com.

bnw

unread,
May 28, 2010, 2:22:07 PM5/28/10
to gheat
You might want to include a couple lines about how to run the script
for people who have never touched python like me.

I did this:

import subprocess
subprocess.call(["C:/Python26/Python.exe", "db.py", "sync"])
> > gheat%2Bunsu...@googlegroups.com<gheat%252Buns...@googlegroups.com­>

Chad Whitacre

unread,
May 28, 2010, 2:35:13 PM5/28/10
to gh...@googlegroups.com
That's intense. Why not just run it from the command line?

C:/>C:/Python26/Python.exe db.py sync


To unsubscribe from this group, send email to gheat+un...@googlegroups.com.

Júlio César Chaves

unread,
May 27, 2010, 5:03:03 PM5/27/10
to gh...@googlegroups.com
I got a situation like that , I had x, y, fuzzy value . But in the gheat you need to repeat the points as much as you want to "heat", so I did this poor script.
The table swap is inside points.db and it is a load from my data, so I gave the necessary repetitions with the hottest points.
I hope this help...
You may adjust the "count" paramenter.


#!/usr/bin/env python
import os
import sqlite3
import numpy as np
 
import aspen
aspen.configure()

DBPATH = os.path.join(aspen.paths.__, 'var', 'points.db')
conn = sqlite3.connect(DBPATH)
c = conn.cursor()
c.execute('select fuzzy from swap')
fuzzy = np.array([c.fetchmany(10000)])

"""
print 'Desvio padrao ',np.std(fuzzy)
print 'Media ',np.ma.average(fuzzy)
print 'Maximo ', np.amax(fuzzy)
print 'Minimo ', np.amin(fuzzy)
print 'Coeficiente de variacao ', (np.std(fuzzy))/(np.ma.average(fuzzy))
"""

media = np.ma.average(fuzzy)
max = np.amax(fuzzy)
min = np.amin(fuzzy)

count = 656
balde = (max - media) /5
minaux = media
maxaux = max
minbalde = [[] for i in range(1525)]
maxbalde = [[] for i in range(1525)]
fuzzy = np.array([[] for i in range(10000)])
sequence = 0
for i in range(1, 6):
    minbalde[i] = minaux + 1
    maxbalde[i] = minaux + balde -1
    minaux = maxbalde[i]
    #print '###', minbalde[i]
    #print '###', maxbalde[i]
    for j in range (1, i):
     for limites in [(minbalde[i], maxbalde[i])]:
      c.execute('select lat, long from swap where fuzzy >=? and fuzzy<=?', limites)
      #c.fetchmany(balde)
      for row in c:
       sequence = sequence + 1
       print sequence, "," , row[0] , "," , row[1]
       if i > 5 :
        for w in range(1, i):
         sequence = sequence + 1
         print sequence, "," , row[0] + (0.00001) , "," , row[1] + (0.00001)
         sequence = sequence + 1
         print sequence, "," , row[0] - (0.00001) , "," , row[1] - (0.00001)
         sequence = sequence + 1
         print sequence, "," , row[0] + (0.00001) , "," , row[1] - (0.00001)
         sequence = sequence + 1
         print sequence, "," , row[0] - (0.00001) , "," , row[1] + (0.00001)
         sequence = sequence + 1
         print sequence, "," , row[0] + (0.00001) , "," , row[1]
         sequence = sequence + 1
         print sequence, "," , row[0] - (0.00001) , "," , row[1]
         sequence = sequence + 1
         print sequence, "," , row[0] , "," , row[1] - (0.00001)
         sequence = sequence + 1
         print sequence, "," , row[0] , "," , row[1] + (0.00001)
c.close()





Júlio César Chaves

Júlio César Chaves

unread,
May 28, 2010, 1:53:49 PM5/28/10
to gh...@googlegroups.com
Good,

Someone knows how to show the gheat results in a WEB client only machine ?
Something that could execute the codes remotely in a embedded page ?



Júlio César Chaves


It's working O_O
To unsubscribe from this group, send email to gheat+un...@googlegroups.com.

bnw

unread,
Jun 3, 2010, 11:12:49 AM6/3/10
to gheat

Chad Whitacre

unread,
Jun 5, 2010, 7:26:15 PM6/5/10
to gh...@googlegroups.com
Are you asking how to integrate gheat into a webpage w/o the server-side component?


chad




2010/5/28 Júlio César Chaves <julio....@gmail.com>

Júlio César Chaves

unread,
Jun 7, 2010, 9:25:57 AM6/7/10
to gh...@googlegroups.com
Hi Chad, yes that's it, "how to integrate gheat into a a webpage as a server-side component?"
You could sell a kind of hosting services and put the GEO data into a cloud...

Júlio César Chaves

Chad Whitacre

unread,
Jun 7, 2010, 10:53:25 PM6/7/10
to gh...@googlegroups.com
Julio,

The thought has occurred to me, but I'm not really in a position to make it happen at the present time. If someone else wants to tackle it, more power to them. :-)

There was a company called Fortius One doing something similar a couple years ago. As I recall, they generated a single heatmap image per map rather than breaking it up into tiles. They had a commercial offering, though, I guess is what I'm saying.


chad




2010/6/7 Júlio César Chaves <julio....@gmail.com>

Steven Lehrburger

unread,
Jun 7, 2010, 11:16:48 PM6/7/10
to gh...@googlegroups.com
http://www.heatmapapi.com/ seems somewhat similar to a hosted gheat?

Júlio César Chaves

unread,
Jun 8, 2010, 7:45:13 AM6/8/10
to gh...@googlegroups.com
Good to know, I saw the website but I imagined something more dynamic like "load 100 points for free" and then pay for the extra points.

Júlio César Chaves

Júlio César Chaves

unread,
Jun 8, 2010, 7:49:31 AM6/8/10
to gh...@googlegroups.com
I know them, I bought the payed version, but unfortunately the heat image does not scale well for little areas with a huge number of points, my case. The other problem with this API is that you can't just load your points, you must write some code.

Júlio César Chaves
Reply all
Reply to author
Forward
0 new messages