Ignore:
Timestamp:
Sep 5, 2011, 3:47:10 PM (13 years ago)
Author:
rick
Message:

Example to reduce the fine grain results if needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/wlheatmap/tile.py

    r9577 r9662  
    44#
    55# Rick van der Zwet <info@rickvanderzwet.nl>
     6from collections import defaultdict
    67from django.core.management import setup_environ
    78from django.db.models import Max
     
    208209  # Limit such that high level zooms does not get the whole database
    209210  metingen = Meting.objects.filter(**filter).order_by('?')[:1000].values_list('latitude', 'longitude', 'signaal')
     211
     212  # Round numbers example to a less fine grain measurements
     213  # d = defaultdict(list)
     214  # for lat,lon, signaal in metingen:
     215  #   d[(round(lat,5),round(lon,5))].append(signaal)
     216
     217  # metingen = []
     218  # for (lat,lon),signals in d.iteritems():
     219  #   metingen.append((lat,lon,max(signals)))
    210220
    211221  # XXX: Signal is not normalized in the database making it unknown when a
Note: See TracChangeset for help on using the changeset viewer.