mirror of
https://github.com/sstent/StuTracker.git
synced 2026-01-26 02:22:01 +00:00
Update index.html
This commit is contained in:
19
index.html
19
index.html
@@ -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: '© <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');
|
||||
|
||||
Reference in New Issue
Block a user