Changeset 9596 for src/django_gheat/wlheatmap
- Timestamp:
- Aug 28, 2011, 3:08:38 PM (13 years ago)
- Location:
- src/django_gheat/wlheatmap
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/feature.py
r9594 r9596 13 13 "properties": { 14 14 'name' : node.name, 15 'color' : 'rgb(0,255,0)', 15 16 }, 16 17 "geometry": { -
src/django_gheat/wlheatmap/filters.py
r9592 r9596 20 20 # Get list if accespoints found in the specific 'Meting', and make this is list. 21 21 wirelessleiden_ssid = Meting.objects.filter(meetrondje=mr, 22 accespoint__organization__name ='WirelessLeiden').\22 accespoint__organization__name__startswith='Wireless').\ 23 23 values_list('accespoint__ssid',flat=True).\ 24 24 order_by('accespoint__ssid').distinct() -
src/django_gheat/wlheatmap/nodelist.py
r9592 r9596 40 40 filter = {} 41 41 filter.update({ 42 'organization__name ' : 'WirelessLeiden',42 'organization__name__startswith' : 'Wireless', 43 43 'meting__latitude__lt' : maxlat, 44 44 'meting__longitude__lt' : maxlon, -
src/django_gheat/wlheatmap/static/heatmap.js
r9594 r9596 69 69 //map.addLayer(layerHeatmap); 70 70 71 // create the layer styleMap by giving the default style a context 72 var colors = ["red", "green", "blue"]; 73 var context = { 74 getSize: function(feature) { 75 var resolution = map.getResolution(); 76 var scale = map.getZoom(); 77 var base = 1; 78 if (scale > 16) { 79 base = 5; 80 } else if (scale > 14) { 81 base = 20; 82 } else { 83 base = 50; 84 } 85 return (base / map.getResolution()); 86 } 87 }; 88 var template = { 89 pointRadius: "${getSize}", // using context.getSize(feature) 90 fillColor: "lightgreen", // using context.getColor(feature) 91 strokeWidth: 0.5, 92 }; 93 var style = new OpenLayers.Style(template, {context: context}); 94 var geojson = new OpenLayers.Layer.GML("GeoJSON", "feature/nodes.json", { 95 projection: new OpenLayers.Projection("EPSG:4326"), 96 styleMap: new OpenLayers.StyleMap(style), 97 format: OpenLayers.Format.GeoJSON 98 }); 99 map.addLayer(geojson); 100 71 var nodesLayer = new OpenLayers.Layer.GML.NodesOverlay("Node Locations", "feature/nodes.json", {isBaseLayer: false, visibility: true}); 72 map.addLayer(nodesLayer); 101 73 102 74 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); … … 117 89 $("#default").append("<span id=\"" + layerHeatmap3.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + layerHeatmap3.colour + ")' /><input type=checkbox id=togglelayer checked/><font>" + layerHeatmap3.name + " </font><br /></span>"); 118 90 91 $("#features").append("<span id=\"" + nodesLayer.name + "\"><div id='layer_switcher_colour' style='background-color:rgb(" + nodesLayer.colour + ")' /><input type=checkbox id=togglelayer checked/><font>" + nodesLayer.name + " </font><br /></span>"); 92 119 93 } -
src/django_gheat/wlheatmap/templates/js/LayerBase.js
r9592 r9596 184 184 initialize: function(name, options) { 185 185 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization__name =WirelessLeiden');186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization__name__startswith=Wireless'); 187 187 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 188 188 var newArguments = [name, url, options]; … … 207 207 CLASS_NAME: "OpenLayers.Layer.Overlay" 208 208 }); 209 210 var foo; 211 212 // create the layer styleMap by giving the default style a context 213 var context = { 214 getSize: function(feature) { 215 var resolution = map.getResolution(); 216 var scale = map.getZoom(); 217 var base = 1; 218 if (scale > 16) { 219 base = 5; 220 } else if (scale > 14) { 221 base = 20; 222 } else { 223 base = 50; 224 } 225 return (base / map.getResolution()); 226 }, 227 getColor: function(feature) { 228 return feature.attributes.color; 229 230 } 231 }; 232 var template = { 233 pointRadius: "${getSize}", // using context.getSize(feature) 234 fillColor: "${getColor}", // using context.getColor(feature) 235 strokeWidth: 0.5, 236 }; 237 var nodesStyle = new OpenLayers.Style(template, {context: context}); 238 239 OpenLayers.Layer.GML.NodesOverlay = OpenLayers.Class(OpenLayers.Layer.GML, { 240 initialize: function(name, options) { 241 var url = "{% url wlheatmap.feature.nodes_json %}"; 242 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 243 var newArguments = [name, url, options]; 244 OpenLayers.Layer.GML.prototype.initialize.apply(this, newArguments); 245 }, 246 colour: '0,255,0', 247 projection: new OpenLayers.Projection("EPSG:4326"), 248 styleMap: new OpenLayers.StyleMap(nodesStyle), 249 format: OpenLayers.Format.GeoJSON, 250 CLASS_NAME: "OpenLayers.Layer.Overlay" 251 }); 252
Note:
See TracChangeset
for help on using the changeset viewer.