Thursday, January 19, 2017

Marinetraffic.com - Free world wide ship tracker

When we got a house overlooking the Chesapeake Bay one of the first things I did was wonder about the big ships in the distance. A little web searching an I discovered there was a worldwide standard for tracking ships using on-board GPS and radios to shore. This is AIS. At first it was just numbers but eventually a number of groups took teh raw GPS position data and added web access and nice zoom-able maps. Later more and more meta-data was added to the unique ship ID so you could track their paths, look at ships type and size and finally see old pictures of the ships at various points. Several services are available, but my favorite free one is marinetraffic.com.

ais_bay_example.png
Note the above image is just a static snapshot!

You can embed location specific maps in your web page (HTML, PHP or whatever), such as Click here for live example. The following is the full HTML and javascript for this example.

<html>
<title>MarineTraffic Embed Example</title>
<body>
<p>
<p> MarineTraffic Embed Example at WidgetBlender, resized for a smart phone, centered on the Middle Chesapeake Bay
<p>
<script type="text/javascript">
 width='500';	// the width of the embedded map in pixels or percentage
 height='500';	// the height of the embedded map in pixels or percentage
 border='1';	// the width of the border around the map (zero means no border)
 shownames='false';	// to display ship names on the map (true or false)
 latitude='38.2';	// the latitude of the center of the map, in decimal degrees
 longitude='-76.0';	// the longitude of the center of the map, in decimal degrees
 zoom='7';	// the zoom level of the map (values between 2 and 17)
 maptype='1';	// use 0 for Normal Map, 1 for Satellite, 2 for OpenStreetMap
 trackvessel='0';	// MMSI of a vessel (note: vessel will be displayed only if within range of the system) - overrides "zoom" option
 fleet='';	// the registered email address of a user-defined fleet (user's default fleet is used)
</script>
  
<script type="text/javascript" src="//www.marinetraffic.com/js/embed.js"></script>

</body>
</html>