Changeset 9201
- Timestamp:
- May 16, 2011, 12:45:26 PM (14 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/nodelist.py
r9196 r9201 11 11 from django.core import serializers 12 12 from gheat.models import * 13 from gheat import gmerc 13 14 import logging 14 15 import pygame … … 16 17 import tempfile 17 18 19 def get_bounds(zoom,lat,lon): 20 21 # Getting max radius for zoomlevel. Note that it will make a square using this, not a circle. 22 SIZE = 250 23 tile_height = float(40008000) / (2 ** zoom) 24 meters_per_pixel = float(tile_height) / SIZE 25 radius = 150 / meters_per_pixel 26 27 # Getting pixel location for mouseposition 28 mouse_x, mouse_y = gmerc.ll2px(lat,lon,zoom) 29 30 max_x = int(mouse_x + radius) 31 max_y = int(mouse_y + radius) 32 min_x = int(mouse_x - radius) 33 min_y = int(mouse_y - radius) 34 35 max_lat, max_lon = gmerc.px2ll(max_x, min_y, zoom) 36 min_lat, min_lon = gmerc.px2ll(min_x, max_y, zoom) 37 38 return (max_lat, max_lon, min_lat, min_lon) 39 40 18 41 def make_list(zoom,lat,lon): 19 42 20 maxlat = (lat + 0.01) 21 maxlon = (lon + 0.01) 22 minlat = (lat - 0.01) 23 minlon = (lon - 0.01) 43 maxlat, maxlon, minlat, minlon = get_bounds(zoom,lat,lon) 24 44 25 45 filter = {} … … 37 57 return nodelist 38 58 59 39 60 def serve_nodelist(request,zoom,lat,lon,): 40 html = make_list(int(zoom), float(lat), float(lon)) 41 return HttpResponse(html, content_type = 'application/javascript; charset=utf8') 42 61 nodelist = make_list(int(zoom), float(lat), float(lon)) 62 return HttpResponse(nodelist, content_type = 'application/javascript; charset=utf8') -
src/django_gheat/website/static/heatmap.js
r9197 r9201 19 19 }); 20 20 21 map.events.register(' click', map, GetMousePos);21 map.events.register('mouseover', map, GetMousePos); 22 22 function GetMousePos(pos) { 23 23 var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y));
Note:
See TracChangeset
for help on using the changeset viewer.