Marinetraffic.com

Hello,

Maybe someone here can make a component, so i can follow some boates from marinetraffic.com?

greetings justin

Do you have access to the API?

No im sorry i have no access: (

Without access (which seems to be paid only) how do you expect it to work? Or are you expecting someone to give you a way to get the info free.

I mean, if someone has access to the api, it’ll probably be easy, but do you expect someone to pay to develop this?

you are right by that.

But with webscraping i have now two entities:
[sensor.elizabeth_latitude] 52.69642
[sensor.elizabeth_longtitude] 5.288077

now it needs to combine so i can use it on the maps

greetings justin

1 Like
1 Like

thnx:) for this :slight_smile:

You can embed the map. Using the code here https://www.marinetraffic.com/en/p/embed-map

I made a simple html page, viz

<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    
<script type="text/javascript">
    width='100%';<-----><------>// the width of the embedded map in pixels or percentage
    height='450';<-----><------>// 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='-43';<---->// the latitude of the center of the map, in decimal degrees
    longitude='172';<--->// the longitude of the center of the map, in decimal degrees
    zoom='9';<-><------>// 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="http://www.marinetraffic.com/js/embed.js"></script>
</head>

<body>

</body>

</html>

Save that as {CONFIG}/www/marine.html

Then embed it as an iframe

4 Likes

To embed as iframe

panel_iframe:
  marine:
    url: /local/marine.html
    name: Marine Map
    icon: mdi:sailing
4 Likes

Quick note for anyone finding this thread from google searches, there’s an easier way to create an iFrame embed - you can pass in all of the above fields as URL parameters. Just create a lovelace “web” card and set the URL like:

Lat/Lon example: (centery = lat, centerx = lon)
http://www.marinetraffic.com/en/ais/embed/zoom:3/centery:-43/centerx:172/maptype:0/shownames:false/

Track specific boat MMSI example:
https://www.marinetraffic.com/en/ais/embed/showmenu:false/shownames:false/mmsi:244183534/

2 Likes

Can you tell me how you did this? I want to store the data so I can map out a ship’s routes

They have changed the website a little. And i havent find the way i can scrape the exact data again.

Shame. Thanks anyway!

And that’s exactly why webscraping is a bad idea, it can break at any time without forewarning.

The marinetraffic API clearly targets high value customers doing things like fleet management and as such it’s extremely expensive for personal use - over 200€ per month for tracking a single boat with a position every 10 minutes and only using land based AIS receivers. Satellite AIS costs 6 times more. If it’s your own boat you want to track, it’s a lot cheaper to add a cellular modem onboard and transmit your position (and more) to your HA instance.

Or you could have a look at collaborative efforts like AIS Hub. Not sure how good it is compared to marinetraffic or vesselfinder. The data is free over an API or direct stream as long as you participate in the network. So you need an AIS receiver yourself and feed into their database (a DIY receiver is fine I guess). In return you get free access to the aggregate data of all other stations.

2 Likes

This is fantastic, thanks for this, I set this up in iframe and works a treat. We have the QM2 coming to our harbor and now I can track it better on my HA panel I wish we could do this with flight radar, i live in the the flightpath of an airport and would love to have better data (on amap) about the planes coming in and out.

Marinetraffic also have a free tile server that can be used with your own web rendering backend, like OpenLayers or Leaflet, together with for example, openstreetmap:

https://tiles.marinetraffic.com/ais_helpers/shiptilesingle.aspx?output=png&sat=1&grouping=shiptype&tile_size=256&legends=1&zoom={z}&X={x}&Y={y}

It looks like this using OpenLayers, with OSM, OpenSeamap and Marinetraffic tile layers (small card I coded a while ago for HA):

image

You can configure the behavior of the Marinetraffic layer through the URL params. The downside is that updates can be rather slow, as the tiles need to be refreshed.

2 Likes

Here I have explained how to integrate AISHub data into HA:

1 Like


Currently building an extension for that. I keep you posted when everything is stable.

1 Like