Changeset 9596 for src/django_gheat/wlheatmap/static/heatmap.js
- Timestamp:
- Aug 28, 2011, 3:08:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.