Changeset 9166
- Timestamp:
- May 8, 2011, 8:59:15 PM (14 years ago)
- Location:
- src/django_gheat/website
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/website/static/OpenStreetMap.js
r9147 r9166 158 158 initialize: function(name, options) { 159 159 var url = [ 160 "/website/tile/${z}/${x},${y}.png "160 "/website/tile/${z}/${x},${y}.png?colour=255,0,0" 161 161 ]; 162 162 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); … … 167 167 CLASS_NAME: "OpenLayers.Layer.Overlay2" 168 168 }); 169 170 OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, { 171 initialize: function(name, options) { 172 var url = [ 173 "/website/tile/${z}/${x},${y}.png?colour=0,0,255&accespoint__ssid__icontains=WirelessLeiden" 174 ]; 175 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 176 var newArguments = [name, url, options]; 177 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); 178 }, 179 180 CLASS_NAME: "OpenLayers.Layer.Overlay3" 181 }); -
src/django_gheat/website/static/heatmap.js
r9147 r9166 24 24 map.addLayer(layerHeatmap); 25 25 26 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2(" Overlay 2", {isBaseLayer: false, visibility: false});26 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: false}); 27 27 map.addLayer(layerHeatmap2); 28 29 layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true}); 30 map.addLayer(layerHeatmap3); 28 31 29 32 var lon = 4.48907; -
src/django_gheat/website/tile.py
r9152 r9166 144 144 145 145 146 def make_tile(x,y,z ):146 def make_tile(x,y,z,filter={},colour=(255,0,0)): 147 147 """ 148 148 Crude attempt to generate tiles, by placing a gradient circle on a … … 187 187 lat_max = 0 188 188 lon_max = 0 189 189 190 filter.update({ 191 'latitude__lte' : nw_deg.lat, 192 'latitude__gte' : se_deg.lat, 193 'longitude__lte' : se_deg.lon, 194 'longitude__gte' : nw_deg.lon 195 }) 190 196 # TODO: This is currently hard-coded to display _all_ metingen 191 metingen = Meting.objects.select_related().filter( 192 latitude__lte=nw_deg.lat,latitude__gte=se_deg.lat, 193 longitude__lte=se_deg.lon,longitude__gte=nw_deg.lon) 197 metingen = Meting.objects.select_related().filter(**filter) 194 198 195 199 # XXX: Signal is not normalized in the database making it unknown when a … … 232 236 # http://stackoverflow.com/questions/3104781/inverse-distance-weighted-idw-interpolation-with-python 233 237 signal_normalized = MAX_RANGE - (MAX_SIGNAL - meting.signaal) 234 im.add_circle((xcoord,ycoord),float(signal_normalized) / meters_per_pixel, (255,0,0), MAX_SIGNAL - meting.signaal)238 im.add_circle((xcoord,ycoord),float(signal_normalized) / meters_per_pixel,colour, MAX_SIGNAL - meting.signaal) 235 239 236 240 log.info("BoundingBox NW: %s" % nw_deg) … … 248 252 # Create your views here. 249 253 def serve_tile(request,zoom,x,y): 250 im = make_tile(int(x),int(y),int(zoom)) 254 filter = {} 255 colour = (255,0,0) 256 for key, value in request.GET.iteritems(): 257 if key == 'colour': 258 colour = tuple(map(int,value.split(','))) 259 else: 260 filter[key] = value 261 im = make_tile(int(x),int(y),int(zoom),filter=filter,colour=colour) 251 262 response = HttpResponse(mimetype="image/png") 252 263 im.write(response,'png')
Note:
See TracChangeset
for help on using the changeset viewer.