Create SAR Call
+
+
@@ -66,6 +89,24 @@
var marker;
+ // Add the geocoder
+ L.Control.geocoder({
+ defaultMarkGeocode: true
+ })
+ .on('markgeocode', function (e) {
+ if (marker) {
+ map.removeLayer(marker);
+ }
+ var latlng = e.geocode.center;
+ L.marker(latlng).addTo(map);
+ map.setView(latlng, map.getZoom());
+ // Update your form fields with the selected location
+ document.querySelector('input[name="latitude"]').value = latlng.lat;
+ document.querySelector('input[name="longitude"]').value = latlng.lng;
+ })
+ .addTo(map);
+
+
map.on('click', function (e) {
if (marker) {
map.removeLayer(marker);
@@ -82,36 +123,48 @@
{# map.fitBounds(e.target.getBounds());#}
{# });#}
{# map.addLayer(gpxLayer);#}
- {#});#}
+ {#})
+ ;
+ #}
- // If editing, set the marker to the existing coordinates
- var latInput = document.querySelector('input[name="latitude"]');
- var lngInput = document.querySelector('input[name="longitude"]');
- if (latInput.value && lngInput.value) {
- marker = L.marker([latInput.value, lngInput.value]).addTo(map);
- }
+ // If editing, set the marker to the existing coordinates
+ var latInput = document.querySelector('input[name="latitude"]');
+ var lngInput = document.querySelector('input[name="longitude"]');
+ if (latInput.value && lngInput.value) {
+ marker = L.marker([latInput.value, lngInput.value]).addTo(map);
+ }
+ {##}
+ {# #}
-
{% endblock %}
\ No newline at end of file
diff --git a/templates/edit_sar.html b/templates/edit_sar.html
index 605f86d..2095cb2 100644
--- a/templates/edit_sar.html
+++ b/templates/edit_sar.html
@@ -14,46 +14,66 @@
Edit SAR Call
@@ -83,6 +103,17 @@
marker = L.marker([latInput.value, lngInput.value]).addTo(map);
}
+
+
<{% endblock %}
diff --git a/templates/list_sar.html b/templates/list_sar.html
index aec2045..0c47241 100644
--- a/templates/list_sar.html
+++ b/templates/list_sar.html
@@ -11,28 +11,32 @@