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

Last change on this file since 9269 was 9269, checked in by dennisw, 13 years ago

Permalink button works. Resets everything though since it refreshes the page. Layers are displayed in the url which doesn't work for custom layers (since they are reset).

File size: 2.0 KB
Line 
1var map;
2function init(){
3
4 var lat = getURLParameter('lat');
5 var lon = getURLParameter('lon');
6 var zoom = getURLParameter('zoom');
7
8 if(lat=='null' || lon=='null' || zoom=='null'){
9 var lat = 52.14068;
10 var lon = 4.48319;
11 var zoom = 16;
12 }
13 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
14
15 map = new OpenLayers.Map('heatmap', {
16 controls: [
17 new OpenLayers.Control.Navigation(),
18 //new OpenLayers.Control.PanZoomBar(),
19 //new OpenLayers.Control.ScaleLine(),
20 new OpenLayers.Control.Permalink(),
21 new OpenLayers.Control.LayerSwitcher(),
22 new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs }),
23 ],
24 maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892),
25 numZoomLevels:16,
26 maxResolution:156543.0339,
27 units:'m',
28 projection: "EPSG:900913",
29 displayProjection: new OpenLayers.Projection("EPSG:4326")
30 });
31
32 map.events.register('click', map, GetMousePos);
33 function GetMousePos(pos) {
34 var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y));
35 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(pix.lon, pix.lat);
36 var zoomlevel = map.getZoom();
37 getNodeList(zoom, mousepos);
38 }
39
40 layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
41 map.addLayer(layerMapnik);
42
43 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: true});
44 map.addLayer(layerHeatmap2);
45
46 layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true});
47 map.addLayer(layerHeatmap3);
48
49 layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false});
50 map.addLayer(layerHeatmap);
51
52 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
53 map.setCenter (lonLat, zoom);
54}
Note: See TracBrowser for help on using the repository browser.