source: subversion/applications/rendering/genericHeatmapRender/heatmappr.py @ 30554

Last change on this file since 30554 was 16116, checked in by stevefaeembra, 10 years ago

initial version.. very basic heatmapping code using Python/Matplotlib?

File size: 2.1 KB
Line 
1#!/usr/bin/env python
2# -*- coding: UTF8 -*-
3
4from locationFinder_flickr_locations import locationFinder_flickr_locations as locator
5from heatmapPNGgenerator import heatmapPNGgenerator as PNGrenderer
6from KMLGenerator import KMLGenerator
7
8'''
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License along
20    with this program; if not, write to the Free Software Foundation, Inc.,
21    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22'''
23
24if __name__ == '__main__':
25   
26    # coordinate finder
27    finder = locator()
28     
29    # bounds is used for the flickR query as the data set contains lots of outliers.
30    finder.bounds=(-30.0,0.0,20.0,80.0)
31   
32    # find the X,Y,Z points
33    # note that you can query several areas;
34    # the query() calls are cumulative, and do not
35    # override the previous results! This means that
36    # several neighbouring areas can be mapped.
37   
38    finder.query("/United+Kingdom/London/London","region")
39    finder.query("/United+Kingdom/Wales/Cardiff","region")
40    finder.query("/United+Kingdom/Scotland/Edinburgh","region")
41    finder.query("/United+Kingdom/Northern+Ireland/Belfast","region")
42   
43    print finder.getBounds()
44   
45    PNGfile=r'c:\testxyz.png'
46    KMLfile=r'c:\testxyz.kml'
47    heatmap=PNGrenderer(finder, 
48                        opacity=0.66, 
49                        bands=100, 
50                        save=True,
51                        target= PNGfile,
52                        display=False,
53                        logarithmic=True)
54    heatmap.render()
55    KMLGenerator().render(finder, PNGfile, KMLfile)
56    print "Done!"
Note: See TracBrowser for help on using the repository browser.