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