Spaces:
Running
Running
Download map.html from Zx4o/mapcraft-navigator: direct link, hf CLI and curl.
- Browser
- Download file 12.1 kB
-
https://huggingface.co/spaces/Zx4o/mapcraft-navigator/resolve/main/map.html
- Command line
-
hf download hf://spaces/Zx4o/mapcraft-navigator/map.html
-
curl -L -o map.html https://huggingface.co/spaces/Zx4o/mapcraft-navigator/resolve/main/map.html
12.1 kB
| <html lang="en" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Interactive Map - MapCraft Navigator</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <link rel="stylesheet" href="style.css"> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: { | |
| 50: '#f0f9ff', | |
| 100: '#e0f2fe', | |
| 200: '#bae6fd', | |
| 300: '#7dd3fc', | |
| 400: '#38bdf8', | |
| 500: '#0ea5e9', | |
| 600: '#0284c7', | |
| 700: '#0369a1', | |
| 800: '#075985', | |
| 900: '#0c4a6e', | |
| }, | |
| secondary: { | |
| 50: '#faf5ff', | |
| 100: '#f3e8ff', | |
| 200: '#e9d5ff', | |
| 300: '#d8b4fe', | |
| 400: '#c084fc', | |
| 500: '#a855f7', | |
| 600: '#9333ea', | |
| 700: '#7e22ce', | |
| 800: '#6b21a8', | |
| 900: '#581c87', | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> | |
| <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> | |
| </head> | |
| <body class="bg-gray-900 text-gray-100 min-h-screen flex flex-col"> | |
| <!-- Navigation Component --> | |
| <script src="components/navigation.js"></script> | |
| <custom-navigation active-page="map"></custom-navigation> | |
| <!-- Map Container --> | |
| <main class="flex-1 container mx-auto px-4 py-6"> | |
| <div class="mb-6"> | |
| <h1 class="text-3xl font-bold text-gray-100 mb-2">Interactive Map</h1> | |
| <p class="text-gray-400">Pan, zoom, and search for locations. Click on any marker for details.</p> | |
| </div> | |
| <div class="grid grid-cols-1 lg:grid-cols-4 gap-6"> | |
| <!-- Sidebar --> | |
| <div class="lg:col-span-1"> | |
| <div class="bg-gray-800 rounded-xl p-6 border border-gray-700 h-full"> | |
| <h2 class="text-xl font-bold mb-4 text-gray-100 flex items-center"> | |
| <i data-feather="map" class="mr-2 text-primary-400"></i> | |
| Map Controls | |
| </h2> | |
| <!-- Search Box --> | |
| <div class="mb-6"> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">Search Location</label> | |
| <div class="relative"> | |
| <input type="text" id="searchInput" placeholder="Enter address or place name" class="w-full px-4 py-3 bg-gray-700 border border-gray-600 rounded-lg text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"> | |
| <button id="searchButton" class="absolute right-3 top-3 text-gray-400 hover:text-primary-400"> | |
| <i data-feather="search"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Map Controls --> | |
| <div class="mb-6"> | |
| <h3 class="font-medium text-gray-300 mb-3">Map Tools</h3> | |
| <div class="space-y-3"> | |
| <button id="zoomIn" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors"> | |
| <span class="text-gray-200">Zoom In</span> | |
| <i data-feather="zoom-in" class="text-primary-400"></i> | |
| </button> | |
| <button id="zoomOut" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors"> | |
| <span class="text-gray-200">Zoom Out</span> | |
| <i data-feather="zoom-out" class="text-primary-400"></i> | |
| </button> | |
| <button id="resetView" class="w-full flex items-center justify-between px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors"> | |
| <span class="text-gray-200">Reset View</span> | |
| <i data-feather="refresh-cw" class="text-secondary-400"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Sample Locations --> | |
| <div> | |
| <h3 class="font-medium text-gray-300 mb-3">Quick Locations</h3> | |
| <div class="space-y-2"> | |
| <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="40.7128" data-lng="-74.0060"> | |
| <div class="font-medium text-gray-100">New York City</div> | |
| <div class="text-sm text-gray-400">United States</div> | |
| </button> | |
| <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="51.5074" data-lng="-0.1278"> | |
| <div class="font-medium text-gray-100">London</div> | |
| <div class="text-sm text-gray-400">United Kingdom</div> | |
| </button> | |
| <button class="location-btn w-full text-left px-4 py-3 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors" data-lat="35.6762" data-lng="139.6503"> | |
| <div class="font-medium text-gray-100">Tokyo</div> | |
| <div class="text-sm text-gray-400">Japan</div> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Map --> | |
| <div class="lg:col-span-3"> | |
| <div class="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden h-[600px]"> | |
| <div id="map" class="w-full h-full rounded-lg"></div> | |
| </div> | |
| <!-- Map Stats --> | |
| <div class="mt-4 grid grid-cols-1 md:grid-cols-3 gap-4"> | |
| <div class="bg-gray-800 rounded-lg p-4 border border-gray-700"> | |
| <div class="flex items-center"> | |
| <div class="w-10 h-10 rounded-lg bg-primary-900/30 flex items-center justify-center mr-3"> | |
| <i data-feather="maximize" class="text-primary-400"></i> | |
| </div> | |
| <div> | |
| <div class="text-sm text-gray-400">Current Zoom</div> | |
| <div class="text-lg font-bold text-gray-100" id="zoomLevel">12</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-800 rounded-lg p-4 border border-gray-700"> | |
| <div class="flex items-center"> | |
| <div class="w-10 h-10 rounded-lg bg-secondary-900/30 flex items-center justify-center mr-3"> | |
| <i data-feather="target" class="text-secondary-400"></i> | |
| </div> | |
| <div> | |
| <div class="text-sm text-gray-400">Center Coordinates</div> | |
| <div class="text-lg font-bold text-gray-100" id="coordinates">0, 0</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-800 rounded-lg p-4 border border-gray-700"> | |
| <div class="flex items-center"> | |
| <div class="w-10 h-10 rounded-lg bg-primary-900/30 flex items-center justify-center mr-3"> | |
| <i data-feather="map-pin" class="text-primary-400"></i> | |
| </div> | |
| <div> | |
| <div class="text-sm text-gray-400">Markers Placed</div> | |
| <div class="text-lg font-bold text-gray-100" id="markerCount">3</div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- Footer Component --> | |
| <script src="components/footer.js"></script> | |
| <custom-footer></custom-footer> | |
| <script src="script.js"></script> | |
| <script> | |
| feather.replace(); | |
| // Initialize map | |
| document.addEventListener('DOMContentLoaded', function() { | |
| const map = L.map('map').setView([40.7128, -74.0060], 12); | |
| L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
| attribution: '© OpenStreetMap contributors', | |
| maxZoom: 19, | |
| }).addTo(map); | |
| // Add sample markers | |
| const markers = [ | |
| { lat: 40.7128, lng: -74.0060, title: 'New York City', description: 'The Big Apple' }, | |
| { lat: 40.7580, lng: -73.9855, title: 'Times Square', description: 'Famous intersection' }, | |
| { lat: 40.7829, lng: -73.9654, title: 'Central Park', description: 'Urban park' } | |
| ]; | |
| markers.forEach(marker => { | |
| L.marker([marker.lat, marker.lng]) | |
| .addTo(map) | |
| .bindPopup(`<strong>${marker.title}</strong><br>${marker.description}`) | |
| .openPopup(); | |
| }); | |
| // Update zoom level | |
| map.on('zoomend', function() { | |
| document.getElementById('zoomLevel').textContent = map.getZoom(); | |
| }); | |
| // Update coordinates | |
| map.on('moveend', function() { | |
| const center = map.getCenter(); | |
| document.getElementById('coordinates').textContent = | |
| `${center.lat.toFixed(4)}, ${center.lng.toFixed(4)}`; | |
| }); | |
| // Search functionality | |
| document.getElementById('searchButton').addEventListener('click', function() { | |
| const query = document.getElementById('searchInput').value; | |
| if (query) { | |
| alert(`Searching for: ${query}\n\nIn a real implementation, this would connect to a geocoding API.`); | |
| } | |
| }); | |
| // Map controls | |
| document.getElementById('zoomIn').addEventListener('click', function() { | |
| map.zoomIn(); | |
| }); | |
| document.getElementById('zoomOut').addEventListener('click', function() { | |
| map.zoomOut(); | |
| }); | |
| document.getElementById('resetView').addEventListener('click', function() { | |
| map.setView([40.7128, -74.0060], 12); | |
| }); | |
| // Quick location buttons | |
| document.querySelectorAll('.location-btn').forEach(button => { | |
| button.addEventListener('click', function() { | |
| const lat = parseFloat(this.dataset.lat); | |
| const lng = parseFloat(this.dataset.lng); | |
| map.setView([lat, lng], 12); | |
| }); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |