|Project Name||Stars||Downloads||Repos Using This||Packages Using This||Most Recent Commit||Total Releases||Latest Release||Open Issues||License||Language|
|Gazepointheatmap||40||5 years ago||gpl-3.0||Python|
|Easy to use Python command line based tool to generate a gaze point heatmap from a csv file. 👁️|
|Csv Heatmap||33||8 years ago||1||mit||HTML|
|Load CSV and display an interactive heatmap using Google Maps API|
|Dump1090.socket30003||20||6 years ago||3||gpl-3.0||Perl|
|collect dump1090 flight positions using socket30003 and save them as csv|
|Stravaheatmap||18||6 years ago||Python|
|Make a simple heatmap from your strava data|
|Geo Heatmap||7||4 years ago||1||mit||Python|
|Draws geographical heatmap from csv file|
|Cumulative Heatmap Calculation||4||2 years ago||mit||Python|
|fast calculation of heatmap from given points.|
|Regionalcorrelation||3||3 years ago||Python|
|A heatmap visualization library for sighting intensity of data at geographical points contained in generic CSV files|
|Csv Data Heat Map||3||2 months ago||1||gpl-3.0||Python|
|CSV Data to Heat Map Converter|
recursive method for heatmap calculation from given 2D points.
Calculating a heat map is a complex task, because since the user selects a more detailed resolution, the runtime of the calculation increases accordingly. The main difficulty in the calculation is in the sum of all the coordinates for the boundaries of each cell in the heat map. To overcome this problem, the code smart_heatmap.py applied recursive solution:
Note: In one of my other projects, there is a method with even faster runtime! see: cumulative-heatmap-calculation
If we encounter during the process a square that does not intersect at all with the coordinates, we will stop its division. Now, we will save all the squares we calculated with intersection count bigger than zero. Now we got a heat map with the required resolution! As can be seen, the runtime of the calculation using the recursive algorithm is significantly lower than the naive algorithm:
The resolution of the heat map can be adjusted using the "depth" variable. This variable determines how many splits to make in each of the first squares. The larger the "depth" variable, the higher the resolution we get. You can see a diagram describing the split into squares, by each depth:
As mentioned, it is important to make sure that a suitable resolution is chosen for the calculation, since different values for the "depth" variable will lead to different results. A simple example based on the file circle.csv illustrates how different values resulted different outputs:
The heat map calculation performed using the HeatMap object. This object receives a Python list consisting of tuples of X and Y coordinates. Also, the desired depth also must be set for the object. Using the data about the coordinates, the HeatMap calculates the initial squares and performs the recursive calculation on them. At the end of the process, the squares that compose the heat map are calculated, as can be seen in the example process figure (based on the file rome_100000.shp that contain 100,000 points coordinates!):
The final squares can be accessed as one of the data of the object: HeatMap(xy_tpl_lst, depth = 5).heatmap. It is also possible to create a plot based on the results of the heat map using the function built into the object, as in the following example:
from smart_heatmap import HeatMap, loadcsv xy = loadcsv(r'example\circle.csv','x','y') hm = HeatMap(xy, depth=4) hm.plot()
In addition, the calculation results can be exported and saved as files in various formats using the save_map function of the object, as can be seen in the implementation.py file. The function allows to save the results in SHP, KML and CSV format. It should be noted that saving the results as layers is automatically set to geographic coordinate system of WGS_1984_DD.
Also, the data that saved to a KML file gets a color corresponding to the count of its intersection. Example for such output you can see here as interactive MYMAPS page. This output based on the Gibraltar.kml example file and the output also available here: Gibraltar_Output.kml. Also, for convenience, the code contains three XY-tuple-list load functions from SHP, KML and CSV files:
The code uses the following libraries in Python:
An application of the code is attached to this page under the name:
the examples outputs are also attached here.
To use this code, you just need to import it as follows:
# import from smart_heatmap import HeatMap, loadshp # load data xy = loadshp(r'examples\feature_class.shp') # define depth variable depth = 5 # application hm = HeatMap(xy, depth) # plot hm.plot() # save data as csv hm.save_map('filename','csv')
When the variables displayed are:
xy: the given xy coordiantes list.
depth the required depth for the recursion, define the output resolution.
MIT © Etzion Harari