ÿþ<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <title>MarineServicen - live AIS</title> <h3><font color="Black"><b></b></font></h3> <div id="shipmove"></div> </tr> <tr> <style type="text/css" media="screen"> { behavior:url(#default#VML); } .gpopup { width:200px; } .gpopup table { padding:0px; border-collapse:collapse; border:0; font-family: Arial, Verdana, Helvetica, sans-serif, "MS sans serif"; font-size: 10px; text-align:left; color: black; background: white; } #tooltip span { color:white; background:darkblue; font-weight:bold; font-size: 9pt; font-family: Arial, Verdana, Helvetica, sans-serif, "MS sans serif"; white-space: nowrap; } </style> <!-- Get an API key from http://www.google.com/apis/maps/ --> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAvAo5Szy_MJVgbcwimcf8HBQnkdkkSpyZGTCEM4CDCepVEQVv8RQamS-E_8MKnKtNE8IQDf063b3awA" type="text/javascript"></script> <script type="text/javascript"> <!-- // ***SET home coordinates for range and direction calculations. var my_lat = 57.120; var my_lon = 8.598; var dlat = 57.121; var dlon = 8.596; var dsiz = 15; /******************************************************************************* 'args.js', by Charlton Rose Permission is granted to use and modify this script for any purpose, provided that this credit header is retained, unmodified, in the script. *******************************************************************************/ // This function creates the args [] array and populates it with data // found in the URL's search string: function args_init () { args = new Array (); var argstring = window . location . search; if (argstring . charAt (0) != '?') return; argstring = argstring . substring (1, argstring . length); var argarray = argstring . split ('&'); var i; var singlearg; for (i = 0; i < argarray . length; ++ i) { singlearg = argarray [i] . split ('='); if (singlearg . length != 2) continue; var index = singlearg [0]; var value = singlearg [1]; args [index] = value; } } // Call the args_init () function to set up the args [] array: args_init (); // Use any passed parameters for coordinates instead. var mlat = args['lat']; var mlon = args['lon']; if ((mlat != null) && (mlon != null)) { my_lat = mlat; my_lon = mlon; dlat = my_lat; dlon = my_lon; } function loadup() { map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 150))); map.setCenter(new GLatLng(dlat, dlon), dsiz); // Change these to your own part of the world map.addControl(new GOverviewMapControl()); map.setMapType(G_NORMAL_MAP) //map.setMapType(G_HYBRID_MAP) //map.setMapType(G_SATELLITE_MAP) // Set up marker mouseover tooltip div tooltip = document.createElement("div"); map.getPane(G_MAP_FLOAT_PANE).appendChild(tooltip); tooltip.style.visibility="hidden"; icon_k = myicon("http://marineservicen.dk/google/icons/mm_20_black.png", 0); icon_b = myicon("http://marineservicen.dk/google/icons/mm_20_blue.png", 0); icon_a = myicon("http://marineservicen.dk/google/icons/mm_20_gray.png", 0); icon_g = myicon("http://marineservicen.dk/google/icons/mm_20_green.png", 0); icon_r = myicon("http://marineservicen.dk/google/icons/mm_20_red.png", 0); icon_w = myicon("http://marineservicen.dk/google/icons/mm_20_white.png", 0); icon_y = myicon("http://marineservicen.dk/google/icons/mm_20_yellow.png", 0); icon_m = myicon("http://marineservicen.dk/google/icons/mm_20_purple.png", 0); icon_o = myicon("http://marineservicen.dk/google/icons/mm_20_orange.png", 0); icon_n = myicon("http://marineservicen.dk/google/icons/mm_20_brown.png", 0); icon_home = myicon("http://www.google.com/mapfiles/marker.png", 0); // Added to display Home AIS icon_track = myicon("shiptrkicon.gif", 1); // Added to display replay tracks autoUpdate(); } function ais_type(id) { var type1 = new Array('unspecified', 'Reserved', 'Wing In Grnd', '', 'Hi Spd Crft', '', 'Passenger', 'Cargo', 'Tanker', 'Other'); var type2 = new Array('', 'Haz A', 'Haz B', 'Haz C', 'Haz D', '', '', '', '', ''); var type3 = new Array('Fishing', 'Towing', 'Towing', 'Dredger', 'Dive Vessel', 'Military Ops', 'Sail', 'Pleasure Craft', 'Reserved', 'Reserved'); var type5 = new Array('Pilot Vessel', 'SAR', 'Tug', 'Port Tender', 'Anti-polution', 'Law enforce', 'Local Vessel', 'Local Vessel', 'Medical Trans', 'Special craft'); var navaid = new Array('Default Navaid', 'Reference point', 'RACON', 'Off Shore Structure', 'Spare', 'Light, without sectors', 'Light, with sectors', 'Leading Light Front', 'Leading Light Rear', 'Beacon, Cardinal N', 'Beacon, Cardinal E', 'Beacon, Cardinal S', 'Beacon, Cardinal W', 'Beacon, Port hand', 'Beacon, Starboard hand', 'Beacon, Preferred Channel port hand', 'Beacon, Preferred Channel starboard hand', 'Beacon, Isolated danger', 'Beacon, Safe water', 'Beacon, Special mark', 'Cardinal Mark N', 'Cardinal Mark E', 'Cardinal Mark S', 'Cardinal Mark W', 'Port hand Mark', 'Starboard hand Mark', 'Preferred Channel Port hand', 'Preferred Channel Starboard hand', 'Isolated danger', 'Safe Water', 'Manned VTS', // Special Mark 'Light Vessel / LANBY', 'Receiving station'); // Added to show unique icon for Home AIS type = Math.floor(id / 10); rem = id % 10; result = ''; if (type == 3) result = type3[rem]; else if (type == 5) result = type5[rem]; else if (id >= 100) { result = navaid[id-100]; } else { result = type1[type]; if (id < 100 && type2[rem] != '') result = result +' '+type2[rem]; } return result; } function getstatus(status) { switch (parseInt(status)) { case 0: return 'Underway'; break; case 1: return 'At Anchor'; break; case 2: return 'Not Under Command'; break; case 3: return 'Restricted Maneuverability'; break; case 4: return 'Constrained by Her Draught'; break; case 5: return 'Moored'; break; case 6: return 'Aground'; break; case 7: return 'Engaged in Fishing'; break; case 8: return 'Underway by Sail'; break; case 14: return ''; break; case 15: return 'Default (15)'; break; default: return status; break; } } function getaisclass(aisclass) { switch (aisclass) { case "A": return 'AIS Class A'; break; case "B": return 'AIS Class B'; break; case "L": return 'Local GPS'; break; case "N": return 'Navigation Aid'; break; case "P": return 'SAR Aircraft'; break; case "S": return 'AIS Base Station'; break; case "?": return 'Unkown'; break; case " ": return 'No Data'; break; default: return aisclass; break; } } function makeinfo(Lat, Lon, name, type, aisstr, i) { var ais = aisstr.split('!'); var mmsi = ais[0]; var imo = ais[1]; var call = ais[2]; var dest = ais[3]; var eta = ais[4]; var speed = ais[5]; var course= ais[6]; var status= getstatus(ais[7]); var length= ais[8]; var width = ais[9]; var draft = ais[10]; var mtime = ais[11]; var shareid = ais[12]; // Added to show share code in info balloon var aisclass = ais[13]; // Added to show AIS class in info balloon var lookup = ais[14]; //tilføjet for at lave opslag på skib // Convert Lat/Long to NSEW versus +- for display in info balloon with (Math) { if (Lat < 0) { var latstr = abs(Lat); latstr = 'S'+latstr; } else { latstr = 'N'+Lat; } if (Lon < 0) { var lonstr = abs(Lon); lonstr = 'W'+lonstr; } else { lonstr = 'E'+Lon; } // Calculate the RANGE from home location. var la1 = my_lat * PI / 180; var lo1 = my_lon * PI / 180; var la2 = Lat * PI / 180; var lo2 = Lon * PI / 180; var x = (sin(la2) * sin(la1)) + (cos(la2) * cos(la1) * cos(lo2-lo1)); var range = round((((PI / 2) - atan(x / sqrt(-x * x + 1))) * 60 * 180 / PI) * 10) / 10; // Calculate Initial Bearing of ship from home location. var y = sin(lo2 - lo1) * cos(la2); x = cos(la1) * sin(la2) - sin(la1) * cos(la2) * cos(lo2 - lo1); var bearing = round(((atan2(y, x) * 180 / PI) + 360) % 360); // Find farthest ship. if (range > maxrange) { maxrange = range; maxname = name; maxmmsi = mmsi; maxlat = Lat; maxlon = Lon; maxbearing = bearing; maxindex = i; } } if ((type < 100) || (type == 133)) { callstr = '<tr><td>Callsign:</td><td>'+call+'</td></tr>\n'; deststr = '<tr><td>Destination:</td><td>'+dest+'</td></tr>\n'; etastr = '<tr><td>ETA:</td><td>'+eta+'</td></tr>\n'; } else { callstr = ''; deststr = ''; etastr = ''; } if (type < 100) { spdstr = '<tr><td>Speed&Dir:</td><td>'+speed+' kts / '+course+'<sup>o</sup></td></tr>\n'; sizestr = '<tr><td>Size:</td><td>'+length+'m x '+width+'m x '+draft+'m</td></tr>\n'; } else { spdstr = ''; sizestr = ''; } if (mmsi != '') { mmsistr = '<tr><td>MMSI:</td><td>'+mmsi+'</td></tr>\n'; } else { mmsistr = ''; } if (imo > 0) { imostr = '<tr><td>IMO:</td><td>'+imo+'</td></tr>\n'; } else { imostr = ''; } if (mtime != '') { recstr = '<tr><td>Received:</sup></td><td>'+mtime+'</sup></td></tr>\n'; } else { recstr = ''; } if (status != '') { statusstr = '<tr><td>Status:</td><td>'+status+'</td></tr>\n'; } else { statusstr = ''; } // Following entries added to show Share Code, Range & Bearing, and AIS Class if (shareid != '') { sharestr = '<tr><td></td><td></sup></td></tr>\n'; } else { sharestr = ''; } if (range != '') { rangestr = '<tr><td>Range&Bear:&nbsp;&nbsp;</td><td>'+range+'nm / '+bearing+'<sup>o</sup>T</td></tr>\n'; } else { rangestr = ''; } if (aisclass != '') { classstr = getaisclass(aisclass) classstr = '<tr><td></td></tr>\n'; } else { classstr = ''; } lookupstr0 = '</td></td><a target="_blank" href="http://www.fiskerforum.dk/kutterdata/default.asp?mode=soegais&serchStr=name&soeg='+name+'&call='+call+'&imo='+imo+'&mmsi='+mmsi+'&type='+type+'"><b>Søg på FiskerForum</a></p>\n'; return '<div class="gpopup"><table cellpadding="0" cellspacing="0">\n'+ '</td><td>Name:</td><td>'+name+'</a></td></tr>\n'+ callstr+ mmsistr+ imostr+ statusstr+ deststr+ etastr+ '<tr><td>Type:</td><td>'+ais_type(type)+'</td></tr>\n'+ sizestr+ spdstr+ '<tr><td>Location:</td><td>'+latstr+'<sup>o</sup> / '+lonstr+'<sup>o</sup></td></tr>\n'+ rangestr+ classstr+ '<tr><td colspan="2">&nbsp;</td></tr>\n'+ recstr+ sharestr+ lookupstr0+ '</table></div>\n'; } function myicon(image, i) { icon = new GIcon(); if (i == 1) { icon.iconSize = new GSize(4, 4); icon.iconAnchor = new GPoint(2, 4); icon.shadow = ""; icon.shadowSize = new GSize(0, 0); } else { icon.iconSize = new GSize(12, 20); icon.iconAnchor = new GPoint(6, 20); icon.shadow = "http://marineservicen.dk/google/icons/mm_20_shadow.png"; icon.shadowSize = new GSize(22, 20); } icon.infoWindowAnchor = new GPoint(5, 1); icon.image = image; return icon; } function addVector(from, deltax, deltay) { if (deltax == 0 && deltay == 0) return null; var to = new GLatLng(from.lat() + deltay, from.lng() + deltax) var polyline = new GPolyline([from, to], "#00ff00", 2); return polyline; } function get_colour(type) { if (type == 30) return icon_y; if (type == 31) return icon_o; if (type == 32) return icon_o; if (type == 33) return icon_o; if (type == 34) return icon_y; if (type == 35) return icon_k; // "black" if (type == 36) return icon_b; if (type == 37) return icon_b; // "blue" if (type == 38) return icon_w; if (type == 39) return icon_w; if (type == 50) return icon_g; if (type == 51) return icon_g; if (type == 52) return icon_o; // "orange" if (type == 53) return icon_o; if (type == 54) return icon_o; if (type == 55) return icon_k; if (type == 56) return icon_w; if (type == 57) return icon_w; if (type == 58) return icon_g; if (type == 59) return icon_g; if (type == 132) return icon_home; // Added to display Home AIS if (type == 133) return icon_track; // Added to display replay tracks if (type > 99) return icon_a; //"gray" var itype = Math.floor(type/10); switch (itype) { case 7: ball = icon_r; // "red"; break; case 8: ball = icon_m; // "magenta"; break; case 4: ball = icon_b; // "blue"; break; case 6: ball = icon_b; // "blue"; break; default: ball = icon_w; // "white"; break; } return ball; } function createMarker(point, name, html, iconz) { var marker = new GMarker(point, iconz); marker.tooltip = '<div id="tooltip"><span>'+name+'</span></div>'; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); map.addOverlay(marker); GEvent.addListener(marker,"mouseover", function() { showTooltip(marker); }); GEvent.addListener(marker,"mouseout", function() { tooltip.style.visibility="hidden" }); return marker; } function autoUpdate() { GDownloadUrl("data.xml?"+Math.random(), function(data, responseCode) { var xmlDoc = GXml.parse(data); if (!xmlDoc.documentElement) return; var xmlmarker = xmlDoc.documentElement.getElementsByTagName("marker"); var movehtml = ''; var dockhtml = ''; var sepmove = ''; var sepdock = ''; if (!gmarkers) gmarkers = new Array(); if (!htmls) htmls = new Array(); if (!vectors) vectors = new Array(); var Lat, Lon, name, deltax, deltay, type, ais, html, ball, icon; for (var i = 0; i < xmlmarker.length; i++) { Lat = parseFloat(xmlmarker[i].getAttribute("lat")); Lon = parseFloat(xmlmarker[i].getAttribute("lon")); name = xmlmarker[i].getAttribute("name"); deltax = parseFloat(xmlmarker[i].getAttribute("dx")); deltay = parseFloat(xmlmarker[i].getAttribute("dy")); type = parseInt(xmlmarker[i].getAttribute("type")); htmls[i] = makeinfo(Lat, Lon, name, type, xmlmarker[i].getAttribute("ais"), i); icon = get_colour(type); if (gmarkers[i]) { GEvent.clearListeners(gmarkers[i], "click"); GEvent.clearListeners(gmarkers[i], "mouseover"); GEvent.clearListeners(gmarkers[i], "mouseout"); map.removeOverlay(gmarkers[i]); } var point = new GLatLng(Lat, Lon); gmarkers[i] = createMarker(point, name, htmls[i], icon); if (vectors[i]) map.removeOverlay(vectors[i]); vectors[i] = addVector(point, deltax, deltay); if (vectors[i]) map.addOverlay(vectors[i]); //html = "<a href='javascript:findship("+i+")' onmouseover='mymouseover("+i+")' onmouseout='mymouseout()'>"+name+"</a><br>"; html = "<option value='"+i+"'>"+name+"</option>"; if (Math.abs(deltax) > 0 || Math.abs(deltay) > 0) { movehtml += sepmove + html; //sepmove = ", "; } else { movehtml += sepmove + html; //dockhtml += sepdock + html; //sepdock = ", "; } } var shipmove = document.getElementById("shipmove"); if (shipmove) //shipmove.innerHTML = movehtml + '.'; shipmove.innerHTML = "<form><select name='i' onChange=findship(this.value);><option>Find skib - www.marineservicen.dk</option>" + movehtml + "</select></form>"; var shipdock = document.getElementById("shipdocked"); if (shipdock) //shipdock.innerHTML = dockhtml + '.'; shipdock.innerHTML = "<form><select name='i' onChange=findship(this.value);><option>Ligger stille</option>" + dockhtml + "</select></form>"; var shiptime = document.getElementById("shiptime"); if (shiptime) { var currentTime = new Date(); // See eg http://www.tizag.com/javascriptT/javascriptdate.php for // fancier time formatting shiptime.innerHTML = "Sidst opdateret: " + currentTime + '.'; } //html = "<a href='javascript:findship("+maxindex+")' onmouseover='mymouseover("+maxindex+")' onmouseout='mymouseout()'>"+maxname+"</a>"; //var shipfar = document.getElementById("shipfar"); //if (shipfar) { // shipfar.innerHTML = '"' + html + '" MMSI: ' + maxmmsi + ' (Lat: ' + maxlat + '°, Lon: ' + maxlon + '°) Range: ' + maxrange + 'nm - Bearing: ' + maxbearing + '°'; //} maxrange = 0 }); // time out after 1hr. if (refreshcounter++ < numrefresh) window.setTimeout('countDown()', 1000); else { if (document.getElementById("countDownText")) document.getElementById("countDownText").innerHTML = "Press REFRESH to continue updates."; } } // ====== This function displays the tooltip ====== // it can be called from an icon mousover or a sidebar mouseover function showTooltip(marker) { tooltip.innerHTML = marker.tooltip; var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom()); var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom()); var anchor=marker.getIcon().iconAnchor; var width=marker.getIcon().iconSize.width; var height=tooltip.clientHeight; var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y -height)); pos.apply(tooltip); tooltip.style.visibility="visible"; } // ===== This function is invoked when the mouse goes over an entry in the sidebar ===== // It launches the tooltip on the icon function mymouseover(i) { showTooltip(gmarkers[i]) } // ===== This function is invoked when the mouse leaves an entry in the sidebar ===== // It hides the tooltip function mymouseout() { tooltip.style.visibility="hidden"; } // Open the info box for the specified marker. function findship(i){ gmarkers[i].openInfoWindowHtml(htmls[i]); } // ***SET Refresh the data after 'refreshInterval' seconds. // It should not be faster than ship.vbs var refreshInterval = 300; // ***SET numrefresh is the number of times to refresh this page before timing out. var numrefresh = 12; var tooltip; var refreshcounter = 0; var gmarkers; var icon_k; var icon_b; var icon_a; var icon_g; var icon_r; var icon_w; var icon_y; var icon_m; var icon_o; var icon_n; var htmls; var vectors; var map; var countDownTime=refreshInterval+1; var counter; var maxrange = 0; var maxname, maxmmsi, maxlat, maxlon, maxbearing function countDown(){ countDownTime--; if (document.getElementById("countDownText")) document.getElementById("countDownText").innerHTML= "Næste opdate:" + countDownTime + " seconds."; if (countDownTime<=0){ countDownTime=refreshInterval; clearTimeout(counter) autoUpdate() return } counter=setTimeout("countDown()", 1000); } function onLoad() { if (!GBrowserIsCompatible()) { alert("Sorry, the Google Maps API is not compatible with this browser"); } else { setTimeout(loadup, 250); } } //--> </script> </head> <body bgcolor="#FFFFCC" onload="onLoad();" onunload="GUnload()"> <p> <div id="map" style="margin-left: auto; margin-right: auto; width: 100%; height: 93%; border: solid #000"></div> <center> <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais1.html">Danmark</font><a><b></font> &nbsp;&nbsp; <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais-hm.html">Hanstholm<a><b></font> &nbsp;&nbsp; <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais-hh.html">Hirtshals<a><b></font> &nbsp;&nbsp; <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais-tn.html">Thyborøn<a><b></font> &nbsp;&nbsp; <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais-hs.html">Hvide Sande<a><b></font> &nbsp;&nbsp; <a><font size="3"><FONT color=#000000><b><a href="http://www.marineservicen.dk/google/ais-e.html">Esbjerg<a><b></font> <table style="width: 96%"><tr><td> <br> </td></tr></table> </center> </body> </html>