i-Boating : Using leaflet to draw points, lines and polygons on a Nautical Chart.



<!DOCTYPE html>
<html>
<head>
    <title>i-Boating : Using leaflet to draw points, lines and polygons on a Nautical Chart.</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
      html, body, #map {
        width: 100%;
        height: 100%;
        margin: 0;
      }
    </style>

    <!-- Leaflet -->
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" />
    <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>

    <!-- Nautical Mapping -->
    <link rel='stylesheet' href='https://fishing-app.gpsnauticalcharts.com/i-boating-fishing-marine-navigation-sdk/5.5/blc-maps.css?rand=1695425337' />
    <script src='https://fishing-app.gpsnauticalcharts.com/i-boating-fishing-marine-navigation-sdk/5.5/blc-maps.js?rand=1695425337'></script>
    

</head>

<body>
<div id="map"></div>

<!-- Leaflet Nautical Adapter -->
<script src="https://fishing-app.gpsnauticalcharts.com/i-boating-fishing-marine-navigation-sdk/5.5/leaflet-blc-adapter.js?rand=1695425337"></script>
<script>
var map = L.map('map').setView([37.8269, -122.3990], 13);

L.marker([37.8269,-122.3990])
    .bindPopup("Hello <b>Leaflet Nautical</b>!<br>Hello, World!")
    .addTo(map)
    .openPopup();

var latlngs = [[ 37.8269, -122.3990], [37.8211, -122.3396]];
var polyline = L.polyline(latlngs, {color: 'blue'});
polyline.addTo(map);

var latlngs = [ [37.8267, -122.417, ], [ 37.81, -122.413], [ 37.8183, -122.4429] ]
var polygon = L.polygon(latlngs, {color: 'red'});;
polygon.addTo(map);



<!--  This will add nautical charts to the map -->
var gl = L.blcGL({
    blc_access_token:'YOUR_ACCESS_TOKEN_HERE'
}).addTo(map);

</script>
</body>
</html>