Update index.html

This commit is contained in:
2024-06-03 11:36:17 -04:00
committed by GitHub
parent d44bef0729
commit 2c3af2516b

View File

@@ -25,14 +25,14 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<!-- Include Leaflet JavaScript -->
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<!-- Include KML plugin for Leaflet -->
<script src="https://unpkg.com/leaflet-omnivore"></script>
<!-- Include Leaflet Omnivore plugin -->
<script src="https://unpkg.com/leaflet-omnivore@0.3.4/leaflet-omnivore.min.js"></script>
</head>
<body>
<div id="map"></div>
<script>
// Initialize the map
var map = L.map('map').setView([0, 0], 2);
// Initialize the map centered on New York City
var map = L.map('map').setView([40.7128, -74.0060], 12);
// Add OpenStreetMap tiles
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
@@ -40,11 +40,14 @@
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Load the KML file
omnivore.kml('https://share.garmin.com/Feed/ShareLoader/NDB92').addTo(map);
// Replace the following URL with your actual KML URL and credentials
var kmlUrl = 'https://share.garmin.com/Feed/ShareLoader/NDB92';
// Optionally, handle any errors (omnivore doesn't have built-in error handling)
omnivore.kml('https://share.garmin.com/Feed/ShareLoader/NDB92').on('ready', function() {
// Load the KML file
omnivore.kml(kmlUrl).addTo(map);
// Optionally, handle any errors
omnivore.kml(kmlUrl).on('ready', function() {
console.log('KML loaded successfully');
}).on('error', function() {
alert('Failed to load KML');