Index: src/django_gheat/website/tile.py
===================================================================
--- src/django_gheat/website/tile.py	(revision 9149)
+++ src/django_gheat/website/tile.py	(revision 9150)
@@ -1,17 +1,23 @@
 #!/usr/bin/env python
 #
-# Hack to show image generation realtime, sample tile server implementation
+# Hack to show image generation realtime, sample tile server implementation.
 #
 # Rick van der Zwet <info@rickvanderzwet.nl>
-from PIL import Image
 from django.core.management import setup_environ
 from django.http import HttpResponse
 from gheat.models import *
-import ImageDraw
 import logging
-import numpy as np
 import pygame
 import sys
 import tempfile
+
+# Rending with PIL and computation with numpy has proven to be to slow to be
+# usable, but is still in here for refence purposes.
+try:
+  from PIL import Image
+  import ImageDraw
+  import numpy as np
+except ImportError:
+  pass
 
 logging.basicConfig(level=logging.WARNING)
@@ -129,11 +135,19 @@
 
 def make_tile(x,y,z):
-  """ Crude attempt to generate tiles, by placing a gradient circle on a
+  """
+  Crude attempt to generate tiles, by placing a gradient circle on a
   coordinate point.  Generate a larger tile  and make sure to plot related
   points first and then crop it to the required size (250x250).
   
   Many stuff NOT implemented yet, like:
-  - Caching Images
+  - Caching Images.
+  - Conditional Filtering of Meting to allow display of sub-results.
+  - Defining a extra level of transparency if you like to layer multiple tiles
+    on top of each-other.
+  - Color variation, allow the user to dynamically choose a the colour the
+    points to be.
+  - Advanced data plotting, like trying to guess the remainder points.
   """
+  
   SIZE = 250
   
@@ -163,4 +177,6 @@
   lat_max = 0
   lon_max = 0
+  
+  # TODO: This is currently hard-coded to display _all_ metingen
   metingen = Meting.objects.select_related().filter(
      latitude__lte=nw_deg.lat,latitude__gte=se_deg.lat,
@@ -168,4 +184,5 @@
   
   def dif(x,y):
+    """ Return difference between two points """
     return max(x,y) - min(x,y)
   
@@ -178,5 +195,6 @@
     ycoord = dif(nw_deg.lat,meting.latitude) / (resolution_deg.lat)
     log.info(meting.accespoint.ssid, meting.latitude, meting.longitude, xcoord, ycoord)
-    # The radius relates to the zoom-level we are in, and should represent
+
+    # XXX: The radius relates to the zoom-level we are in, and should represent
     # a fixed distance, given the scale. Assume signal/distance to be lineair
     # such that signal 100% = 100m and 1% = 1m.
@@ -184,4 +202,9 @@
     # XXX: The relation is not lineair but from a more logeritmic scape, as we
     # are dealing with radio signals
+    #
+    # TODO: Please note that this 'logic' technically does any apply to WiFi signals,
+    # if you are plotting from the 'source'. With measured data you get
+    # different patterns.
+    #
     im.add_circle((xcoord,ycoord),float(meting.signaal) / meters_per_pixel,(255,0,0))
   
@@ -204,13 +227,2 @@
   im.write(response,'png')
   return response
-
-if __name__ == '__main__':
-  log.setLevel(logging.DEBUG)
-  x = int(sys.argv[1])
-  y = int(sys.argv[2])
-  z = 14
-
-  im = make_tile(x,y,z)
-  filename = 'sample-gradient.png'
-  im.write(open(filename,'w'))
-  log.info("Output saved as '%s'" % filename)
