Spaces:
Running
Running
additional search area fitur - Follow Up Deployment
Browse files- index.html +52 -0
index.html
CHANGED
|
@@ -118,6 +118,17 @@
|
|
| 118 |
</div>
|
| 119 |
|
| 120 |
<div class="control-panel">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
<h2 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
|
| 122 |
<i class="fas fa-info-circle mr-2"></i> Instructions
|
| 123 |
</h2>
|
|
@@ -370,6 +381,47 @@
|
|
| 370 |
function clearMeasurements() {
|
| 371 |
drawnItems.clearLayers();
|
| 372 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
});
|
| 374 |
</script>
|
| 375 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=alterzick/geo-map-distance" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
|
| 118 |
</div>
|
| 119 |
|
| 120 |
<div class="control-panel">
|
| 121 |
+
<h2 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
|
| 122 |
+
<i class="fas fa-search mr-2"></i> Location Search
|
| 123 |
+
</h2>
|
| 124 |
+
<div class="mb-4">
|
| 125 |
+
<input type="text" id="searchInput" placeholder="Search for a location..."
|
| 126 |
+
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 127 |
+
<button id="searchButton" class="mt-2 w-full py-2 px-4 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition">
|
| 128 |
+
Search
|
| 129 |
+
</button>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
<h2 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
|
| 133 |
<i class="fas fa-info-circle mr-2"></i> Instructions
|
| 134 |
</h2>
|
|
|
|
| 381 |
function clearMeasurements() {
|
| 382 |
drawnItems.clearLayers();
|
| 383 |
}
|
| 384 |
+
|
| 385 |
+
// Location search functionality
|
| 386 |
+
const searchInput = document.getElementById('searchInput');
|
| 387 |
+
const searchButton = document.getElementById('searchButton');
|
| 388 |
+
|
| 389 |
+
searchButton.addEventListener('click', searchLocation);
|
| 390 |
+
searchInput.addEventListener('keypress', function(e) {
|
| 391 |
+
if (e.key === 'Enter') {
|
| 392 |
+
searchLocation();
|
| 393 |
+
}
|
| 394 |
+
});
|
| 395 |
+
|
| 396 |
+
function searchLocation() {
|
| 397 |
+
const query = searchInput.value.trim();
|
| 398 |
+
if (!query) return;
|
| 399 |
+
|
| 400 |
+
fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(query)}`)
|
| 401 |
+
.then(response => response.json())
|
| 402 |
+
.then(data => {
|
| 403 |
+
if (data.length > 0) {
|
| 404 |
+
const result = data[0];
|
| 405 |
+
const lat = parseFloat(result.lat);
|
| 406 |
+
const lon = parseFloat(result.lon);
|
| 407 |
+
|
| 408 |
+
map.setView([lat, lon], 14);
|
| 409 |
+
|
| 410 |
+
// Add marker for the found location
|
| 411 |
+
drawnItems.clearLayers();
|
| 412 |
+
L.marker([lat, lon])
|
| 413 |
+
.bindPopup(`<b>${result.display_name}</b>`)
|
| 414 |
+
.addTo(drawnItems)
|
| 415 |
+
.openPopup();
|
| 416 |
+
} else {
|
| 417 |
+
alert('Location not found');
|
| 418 |
+
}
|
| 419 |
+
})
|
| 420 |
+
.catch(error => {
|
| 421 |
+
console.error('Search error:', error);
|
| 422 |
+
alert('Error searching for location');
|
| 423 |
+
});
|
| 424 |
+
}
|
| 425 |
});
|
| 426 |
</script>
|
| 427 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=alterzick/geo-map-distance" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|