Changeset 9587 for src/django_gheat/wlheatmap
- Timestamp:
- Aug 27, 2011, 4:14:19 PM (13 years ago)
- Location:
- src/django_gheat/wlheatmap/static
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/static/heatmap.js
r9584 r9587 22 22 new OpenLayers.Control.Permalink(), 23 23 new OpenLayers.Control.PanZoomBar(), 24 new OpenLayers.Control.ZoomBox(), 24 25 new OpenLayers.Control.OverviewMap({ 25 maximized : true,26 maximized : false, 26 27 mapOptions: { theme: null, }, 27 28 }), … … 67 68 layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false}); 68 69 //map.addLayer(layerHeatmap); 69 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", "/static/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 101 70 102 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()); 71 103 map.setCenter (lonLat, zoom);
Note:
See TracChangeset
for help on using the changeset viewer.