1 | function 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 | map.events.register('click', map, GetMousePos);
|
---|
22 | function GetMousePos(pos) {
|
---|
23 | var pixel = new OpenLayers.Pixel(pos.xy.x,pos.xy.y);
|
---|
24 | var lonlat = map.getLonLatFromPixel(pixel);
|
---|
25 | var mousepos = OpenLayers.Layer.SphericalMercator.inverseMercator(lonlat.lon, lonlat.lat);
|
---|
26 | loadXMLDoc(mousepos);
|
---|
27 | //var url = "/website/wlnode/" + mousepos.lat + "," + mousepos.lon;
|
---|
28 | //window.location = url;
|
---|
29 | }
|
---|
30 |
|
---|
31 | layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
|
---|
32 | map.addLayer(layerMapnik);
|
---|
33 | layerHeatmap = new OpenLayers.Layer.OSM.Overlay1("Overlay 1", {isBaseLayer: false, visibility: true});
|
---|
34 | map.addLayer(layerHeatmap);
|
---|
35 |
|
---|
36 | layerHeatmap2 = new OpenLayers.Layer.OSM.Overlay2("All Access points", {isBaseLayer: false, visibility: false});
|
---|
37 | map.addLayer(layerHeatmap2);
|
---|
38 |
|
---|
39 | layerHeatmap3 = new OpenLayers.Layer.OSM.Overlay3("Wireless Leiden Only", {isBaseLayer: false, visibility: true});
|
---|
40 | map.addLayer(layerHeatmap3);
|
---|
41 |
|
---|
42 | var lon = 4.48907;
|
---|
43 | var lat = 52.158431;
|
---|
44 | var zoom = 16;
|
---|
45 |
|
---|
46 | var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
|
---|
47 | map.setCenter (lonLat, zoom);
|
---|
48 | }
|
---|
49 |
|
---|
50 | function loadXMLDoc(mousepos)
|
---|
51 | {
|
---|
52 | var xmlhttp;
|
---|
53 | var txt,xx,x,i;
|
---|
54 | if (window.XMLHttpRequest)
|
---|
55 | {// code for IE7+, Firefox, Chrome, Opera, Safari
|
---|
56 | xmlhttp=new XMLHttpRequest();
|
---|
57 | }
|
---|
58 | else
|
---|
59 | {// code for IE6, IE5
|
---|
60 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | xmlhttp.onreadystatechange=function()
|
---|
65 | {
|
---|
66 | if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
---|
67 | {
|
---|
68 | txt="";
|
---|
69 | x=xmlhttp.responseXML.documentElement.getElementsByTagName("CD");
|
---|
70 | for (i=0;i<x.length;i++)
|
---|
71 | {
|
---|
72 | xx=x[i].getElementsByTagName("ARTIST");
|
---|
73 | txt=txt + xx[0].firstChild.nodeValue + "<br>";
|
---|
74 | }
|
---|
75 | document.getElementById('nodelist').innerHTML=txt;
|
---|
76 | }
|
---|
77 | }
|
---|
78 | xmlhttp.open("POST","/static/test.xml",true);
|
---|
79 | //xmlhttp.open("POST","/website/lat=" + mousepos.lat + "&lon=" + mousepos.lon,true);
|
---|
80 | xmlhttp.send();
|
---|
81 | }
|
---|