3 import Image, ImageDraw
5 def circle (image, percentX, percentY, radiusX, radiusY, colorIn, colorOut):
7 imageX, imageY = image.size
8 centerX = int(imageX*percentX)
9 centerY = int(imageY*percentY)
10 x = max (0, min (centerX,imageX))
11 y = max (0, min (centerY,imageY))
18 draw = ImageDraw.Draw (image)
19 draw.chord((x1,y1,x2,y2), 0, 360, fill=colorIn, outline=colorOut )
24 path = '/var/www/html/'
25 original = path + 'map.png'
26 live = path + 'livemap.png'
28 # map characteristics, in degrees.
29 # latitude : positive is north
30 # longitude : positive is east
33 longitude={'left':-11.,
36 # circle radius in pixels
38 # circle in and out colors
39 cIn,cOut='#566b8a','#bbbbbb'
41 image = Image.open(original)
43 for site in GetSites():
44 if site['longitude'] is not None and site['latitude'] is not None:
45 px=float(longitude['left']-site['longitude'])/float(longitude['left']-longitude['right'])
46 py=float(latitude['top']-site['latitude'])/float(latitude['top']-latitude['bottom'])
47 if (px=0 or py=0 or px=1 or py=1)
50 circle(image,px,py,sx,sy,cIn,cOut)
54 if __name__ == '__main__':