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

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

Custom layer switcher has it's own div now. Some visual stuff added like div toggle and categories (Base layers, Users, etc).

File size: 2.6 KB
RevLine 
[9203]1var map;
[9139]2function init(){
3
[9269]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 }
[9264]13 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
[9139]14
[9264]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 });
[9175]31
[9264]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 }
[9175]39
[9264]40 layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
41 map.addLayer(layerMapnik);
[9147]42
[9264]43 layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: true});
44 map.addLayer(layerHeatmap2);
[9166]45
[9264]46 layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true});
47 map.addLayer(layerHeatmap3);
[9190]48
[9264]49 layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Original Heatmap generator", {isBaseLayer: false, visibility: false});
50 map.addLayer(layerHeatmap);
[9139]51
[9264]52 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
53 map.setCenter (lonLat, zoom);
[9274]54
55 $("#default").append("<span id=\"" + layerHeatmap.name + "\"><input type=checkbox id=togglelayer /><font style='color:rgb(" + layerHeatmap.colour + ")'>" + layerHeatmap.name + " </font><a id=rmvlayer>X</a><br /></span>");
56
57 $("#default").append("<span id=\"" + layerHeatmap2.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap2.colour + ")'>" + layerHeatmap2.name + " </font><a id=rmvlayer>X</a><br /></span>");
58
59 $("#default").append("<span id=\"" + layerHeatmap3.name + "\"><input type=checkbox id=togglelayer checked/><font style='color:rgb(" + layerHeatmap3.colour + ")'>" + layerHeatmap3.name + " </font><a id=rmvlayer>X</a><br /></span>");
60
61
62
63
[9139]64}
Note: See TracBrowser for help on using the repository browser.