Open Henner opened 10 years ago
see example: http://demo.stage.miadi.net/heatmaps/heatmap.html
I dynamically set the width and height based on a selectable value 'pixels per degree' (PPD). I then scale this with an upper bound of 8192 which is based of the maximum texture size of the google earth client. Select your preferred PPD based on what quality image you are after/how far in you intend to zoom.
width = int((east - west)*PPD + dotsize/2)
height = int((north - south)*PPD + dotsize/2)
largestVal = max(width,height)
if largestVal > MAX_SIZE:
scale = float(MAX_SIZE)/largestVal
height = int(height*scale)
width = int(width*scale)
PPD = float((width-dotsize/2))/(east-west)
dotDegrees = dotsize/2/PPD
bounds = ((west-dotDegrees, south-dotDegrees),(east+dotDegrees,north+dotDegrees))
Updated above post with somewhat tested code. Considering adding it as a method in heatmap.py.
whats the best way to calculate the bounding box for a heatmap of geo points (lng/lat)? The auto calculated way cuts off the circles at the edges of the image...