source: src/django_gheat/wlheatmap/static/heatmap.js@ 9781

Last change on this file since 9781 was 9649, checked in by rick, 13 years ago

IE does not allow arrays to have comma's as well.

File size: 3.0 KB
RevLine 
[9302]1/**
2 * Var 'map' is set global, used in 'heatmap_extensions.js'.
3 */
[9203]4var map;
[9302]5
[9570]6function init_heatmap(){
[9269]7 var lat = getURLParameter('lat');
8 var lon = getURLParameter('lon');
9 var zoom = getURLParameter('zoom');
10
11 if(lat=='null' || lon=='null' || zoom=='null'){
[9316]12 var lat = 52.15514;
13 var lon = 4.48959;
14 var zoom = 13;
[9269]15 }
[9264]16 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984
[9139]17
[9264]18 map = new OpenLayers.Map('heatmap', {
[9583]19 theme: null,
[9264]20 controls: [
21 new OpenLayers.Control.Navigation(),
[9302]22 new OpenLayers.Control.Permalink(),
[9546]23 new OpenLayers.Control.PanZoomBar(),
[9587]24 new OpenLayers.Control.ZoomBox(),
[9583]25 new OpenLayers.Control.OverviewMap({
[9587]26 maximized : false,
[9648]27 mapOptions: { theme: null }
[9583]28 }),
[9649]29 new OpenLayers.Control.MousePosition({ 'displayProjection' : projection_wgs })
[9302]30 /**
31 * Decided to disable these controls.
32 * The layerswitcher has been replaced with a custom one. If you want the original back,
33 * make sure to disable the custom one to prevent collision.
34 */
35
[9576]36 //new OpenLayers.Control.PanZoomBav(),
[9264]37 //new OpenLayers.Control.ScaleLine(),
[9276]38 //new OpenLayers.Control.LayerSwitcher(),
[9264]39 ],
40 maxExtent: new OpenLayers.Bounds(-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892),
41 numZoomLevels:16,
42 maxResolution:156543.0339,
43 units:'m',
44 projection: "EPSG:900913",
45 displayProjection: new OpenLayers.Projection("EPSG:4326")
46 });
[9175]47
[9264]48 map.events.register('click', map, GetMousePos);
49 function GetMousePos(pos) {
50 var pix = map.getLonLatFromPixel(new OpenLayers.Pixel(pos.xy.x,pos.xy.y));
51 var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(pix.lon, pix.lat);
52 var zoomlevel = map.getZoom();
53 getNodeList(zoom, mousepos);
54 }
[9175]55
[9264]56 layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
57 map.addLayer(layerMapnik);
[9147]58
[9264]59 var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
60 map.setCenter (lonLat, zoom);
[9274]61
62
[9302]63 /**
[9599]64 * Layers are created and put in switcher
[9302]65 */
[9599]66 function add_item(category, layer) {
67 map.addLayer(layer);
68 var checked = '';
69 if (layer.getVisibility()) { checked = "checked='checked'"; };
70 $("#" + category).append("<span id=\"" + layer.name + "\">" +
71 " <div id='layer_switcher_colour' style='background-color:rgb(" + layer.colour + ")' />" +
72 "<input type='checkbox' id='togglelayer' " + checked + " /><font>" + layer.name + " </font><br /></span>"
73 );
74 }
[9302]75
[9599]76 var signallayer = new OpenLayers.Layer.OSM.Overlay4("signallayer", {isBaseLayer: false, visibility: false});
77 var wlsignalLayer = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Coverage", {isBaseLayer: false, visibility: true});
78 var nodesLayer = new OpenLayers.Layer.GML.NodesOverlay("Node Locations", {isBaseLayer: false, visibility: false});
[9274]79
[9599]80 add_item('default', signallayer);
81 add_item('default', wlsignalLayer);
82 add_item('features', nodesLayer);
[9139]83}
Note: See TracBrowser for help on using the repository browser.