Changeset 8468 in genesis for nodes/nodemap.html
- Timestamp:
- Sep 19, 2010, 7:43:41 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/nodemap.html
r8457 r8468 1 <html> 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 2 4 <head> 3 <title>Wireless Leiden Nodemap using OpenLayers.org and OpenSteetmap.org</title> 4 <style type="text/css"> 5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 6 <title>Wireless Leiden Nodemap using OpenLayers.org and OpenSteetmap.org</title> 7 <style type="text/css"> 5 8 html, body, #basicMap { 6 9 width: 100%; … … 8 11 margin: 0; 9 12 } 10 </style> 11 <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAKRiFs2kXKhTkKZkE_ms9rhTdBXm62xfhQU7Dk6ZBFSzYdmSteRQWjLqZhwX8afHvGpd4N3iKql6w8g" type="text/javascript"></script> 13 </style> 14 <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAKRiFs2kXKhTkKZkE_ms9rhTdBXm62xfhQU7Dk6ZBFSzYdmSteRQWjLqZhwX8afHvGpd4N3iKql6w8g" type="text/javascript" /> 15 <script src="http://openlayers.org/dev/OpenLayers.js" type="text/javascript" /> 16 <script type="text/javascript"> 12 17 13 <script src="http://openlayers.org/dev/OpenLayers.js"</script> 14 15 <script> 18 <![CDATA[ 16 19 var url_pal3 = "http://maps.google.com/mapfiles/kml/pal3/"; 17 20 var map, rulerControl, clickControl; … … 19 22 var projection_wgs = new OpenLayers.Projection("EPSG:4326"); // WGS 1984 20 23 var projection_smp = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator Projection 21 24 22 25 var current_opacity = 0.5; 23 26 var max_opacity = 0.9; 24 27 var min_opacity = 0.1; 25 28 26 29 var nodeStatusImg = new Array(); 27 30 nodeStatusImg['up'] = 'http://www.google.com/mapfiles/kml/paddle/grn-stars-lv.png'; … … 29 32 nodeStatusImg['planned'] = 'http://www.google.com/mapfiles/kml/paddle/wht-stars-lv.png'; 30 33 nodeStatusImg['unknown'] = 'http://www.google.com/mapfiles/kml/paddle/wht-stars-lv.png'; 31 34 32 35 function log(message) { 33 36 /* Determine whether Firebug is actually installed and activated before trying to log … … 38 41 } 39 42 } 40 43 41 44 function isInterlink(feature) { 42 45 return (feature.attributes.name.indexOf('Interlink') != -1); 43 46 } 44 47 45 48 OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { 46 49 defaultHandlerOptions: { … … 51 54 'stopDouble': false 52 55 }, 53 56 54 57 initialize: function(options) { 55 58 this.handlerOptions = OpenLayers.Util.extend( … … 65 68 ); 66 69 }, 67 70 68 71 trigger: function(e) { 69 72 var lonlat = map.getLonLatFromViewPortPx(e.xy); … … 74 77 'Copy/paste URL in NEW browser window to get your RDNAP coordinates\n\n' + url); 75 78 } 76 79 77 80 }); 78 79 81 82 80 83 function setOpacity(new_opacity) { 81 84 current_opacity = new_opacity; … … 83 86 wms.setOpacity(new_opacity); 84 87 } 85 88 86 89 function changeOpacity(by_opacity) { 87 90 var new_opacity = current_opacity + by_opacity; … … 89 92 setOpacity(new_opacity); 90 93 } 91 94 92 95 function init() { 93 96 map = new OpenLayers.Map("basicMap"); 94 97 95 98 var world_bound = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34); 96 99 // Development focus maps … … 98 101 wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", 99 102 "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 100 103 101 104 // Added extra's 102 105 var google_sat = new OpenLayers.Layer.Google("Google Satellite" , … … 112 115 wrapDateLine: false 113 116 }); 114 117 115 118 116 119 map.addLayers([mapnik, wms, google_sat, google_normal]); 117 120 setOpacity(0.5); 118 121 defaultFocus(); 119 120 122 123 121 124 //var pois = new OpenLayers.Layer.Text( "My Points", 122 125 // { location:"./textfile.txt", … … 124 127 // }); 125 128 //map.addLayer(pois); 126 129 127 130 //function parseKML(req) { 128 131 // alert(req.responseText); 129 132 //}; 130 133 //alert(OpenLayers.loadURL("./kmlfile.kml", "", null, parseKML)); 131 132 134 135 133 136 function ignoreInterlink(cluster, feature) { 134 137 if (isInterlink(feature)) { … … 137 140 return strategy.shouldClusterOrig(cluster, feature); } 138 141 }; 139 142 140 143 strategy = new OpenLayers.Strategy.Cluster(); 141 144 strategy.shouldClusterOrig = strategy.shouldCluster; … … 143 146 strategy.distance = 10; 144 147 strategy.threshold = 2; 145 148 146 149 //OpenLayers.Feature.Vector.style["default"]); 147 150 148 151 var symbolizer = new OpenLayers.Style({ 149 152 externalGraphic: "${icon}", … … 178 181 } 179 182 }); 180 183 181 184 var styleMap = new OpenLayers.StyleMap({"default": symbolizer, "select": {pointRadius: 16,fillOpacity: 1}}); 182 185 183 186 // Hack to get around all kind of caching fails 184 187 var epoch = new Date().getTime(); … … 194 197 }); 195 198 map.addLayer(kml); 196 199 197 200 select = new OpenLayers.Control.SelectFeature(kml); 198 201 kml.events.on( { … … 202 205 map.addControl(select); 203 206 select.activate(); 204 207 205 208 clickControl = new OpenLayers.Control.Click(); 206 209 map.addControl(clickControl); 207 210 clickControl.deactivate(); 208 209 211 212 210 213 var vectors = new OpenLayers.Layer.Vector("Vector Layer") 211 214 map.addLayer(vectors); … … 218 221 map.addControl(new OpenLayers.Control.KeyboardDefaults()); 219 222 map.addControl(new OpenLayers.Control.ZoomBox()); 220 221 223 224 222 225 //var in_options = { 223 226 // 'internalProjection': map.baseLayer.projection, … … 233 236 //// } 234 237 //txtFile.send(null); 235 238 236 239 //var features = wkt.read(txtFile.responseText.replace(/\n/g,'')); 237 240 //var bounds; … … 252 255 // alert("ERROR in WTK"); 253 256 //} 254 255 257 258 256 259 // style the sketch fancy 257 260 var sketchSymbolizers = { … … 293 296 } 294 297 ); 295 298 296 299 rulerControl.events.on({ 297 300 "measure": handleMeasurements, … … 300 303 map.addControl(rulerControl); 301 304 } 302 305 303 306 function resize() { 304 307 size = new OpenLayers.Size(size.w + 10, size.h + 10); 305 308 icon.setSize(size); 306 309 } 307 310 308 311 function onPopupClose(evt) { 309 312 select.unselectAll(); 310 313 } 311 312 313 314 315 316 314 317 function onKMLFeatureSelect(event) { 315 318 var feature = event.feature; … … 339 342 map.addPopup(popup); 340 343 } 341 344 342 345 function onKMLFeatureUnselect(event) { 343 346 var feature = event.feature; … … 348 351 } 349 352 } 350 353 351 354 function handleMeasurements(event) { 352 355 // For some reason 'delayed' events get posted even though the object … … 367 370 element.innerHTML = out; 368 371 } 369 372 370 373 function toggleClickControl() { 371 374 if (!clickControl.active) { … … 378 381 } 379 382 } 380 383 381 384 function toggleRulerControl() { 382 385 if (!rulerControl.active) { … … 389 392 } 390 393 } 391 394 392 395 function defaultFocus() { 393 396 map.setCenter(new OpenLayers.LonLat(4.50,52.186) // Center of the map … … 395 398 ); 396 399 } 397 400 398 401 function toggleInfo() { 399 402 var e = document.getElementById('infofield'); … … 404 407 }; 405 408 } 406 407 function coordConvert(lam, phi) {409 410 function coordConvert(lam, phi) { 408 411 var lam_deg = Math.floor(lam); 409 412 var t = (lam - lam_deg) * 60; 410 413 var lam_min = Math.floor(t); 411 414 var lam_sec = (t - lam_min) * 60; 412 415 413 416 var phi_deg = Math.floor(phi); 414 417 var t = (phi - phi_deg) * 60; … … 426 429 return(url); 427 430 } 431 432 // http://openlayers.org/dev/examples/strategy-cluster-threshold.html 433 ]]> 428 434 435 </script> 429 436 430 // http://openlayers.org/dev/examples/strategy-cluster-threshold.html431 </script>432 437 </head> 433 438 <body onload="init();"> 434 439 <div id="basicMap"> 435 440 <div id="controller" style="position: absolute; top: 10px; left : 80px; z-index:1004"> 436 <img id="ruler" src="ruler_off.png" onClick="toggleRulerControl()" /> 437 <img height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon23.png" title="Reset focus" onclick="defaultFocus()"/> 438 <img height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon36.png" title="Information" onclick="toggleInfo()" /> 439 <img id="click" height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon28.png" title="Coordinate converter" onclick="toggleClickControl()" /> 441 <img id="ruler" src="ruler_off.png" onclick="toggleRulerControl()" alt="ruler"/> 442 <img height="22" src="http://maps.google.com/mapfiles/kml/pal3/icon23.png" title="Reset focus" onclick="defaultFocus()" alt="Focus reset" /> 443 <img height="22" 444 src="http://maps.google.com/mapfiles/kml/pal3/icon36.png" 445 title="Information" onclick="toggleInfo()" alt="information" /> 446 <img id="click" height="22" 447 src="http://maps.google.com/mapfiles/kml/pal3/icon28.png" 448 title="Coordinate converter" onclick="toggleClickControl()" 449 alt="coordinate converter"/> 440 450 <div id="output"></div> 441 451 </div>
Note:
See TracChangeset
for help on using the changeset viewer.