source: src/django_gheat/website/static/heatmap.js@ 9147

Last change on this file since 9147 was 9147, checked in by rick, 14 years ago

Alternative heatmap generation 'framework'. Simple/Single file with no
persistent storage, making debugging easy.

This proves that the heatmap code itself is not causing the issues, but the
image manipulation PIL is not so fast (or properly utilized). Might want to
consider a more advanced image generation toolkit. (2000 entries: 5+ secs).

Also loading a large dataset into Objects seems to be very slow. The database
call is effient (just a single one), but building all the related objects,
makes is slow (2000 entries: 1+ sec). Might want to check if raw queries suit
to avoid conversion our needs:

http://docs.djangoproject.com/en/dev/topics/db/sql/

File size: 1.2 KB
Line 
1function init(){
2
3 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
4
5 map = new OpenLayers.Map('heatmap', {
6 controls: [
7 new OpenLayers.Control.Navigation(),
8 new OpenLayers.Control.PanZoomBar(),
9 new OpenLayers.Control.ScaleLine(),
10 new OpenLayers.Control.LayerSwitcher(),
11 new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }),
12 ],
13 maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892),
14 numZoomLevels:16,
15 maxResolution:156543.0339,
16 units:'m',
17 projection: "EPSG:900913",
18 displayProjection: new OpenLayers.Projection("EPSG:4326")
19 });
20
21 layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
22 map.addLayer(layerMapnik);
23 layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Overlay 1", {isBaseLayer: false, visibility: true});
24 map.addLayer(layerHeatmap);
25
26 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("Overlay 2", {isBaseLayer: false, visibility: false});
27 map.addLayer(layerHeatmap2);
28
29 var lon = 4.48907;
30 var lat = 52.158431;
31 var zoom = 16;
32
33 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
34 map.setCenter (lonLat, zoom);
35}
Note: See TracBrowser for help on using the repository browser.