2024-08-18 00:38:09 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
2024-08-17 19:05:28 +00:00
|
|
|
<h1>Add a New Pin</h1>
|
|
|
|
|
<form method="post" enctype="multipart/form-data">
|
|
|
|
|
{{ form.hidden_tag() }}
|
|
|
|
|
<p>
|
|
|
|
|
{{ form.description.label }}<br>
|
|
|
|
|
{{ form.description(size=32) }}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
{{ form.photo.label }}<br>
|
|
|
|
|
{{ form.photo() }}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<label for="lat">Latitude:</label><br>
|
|
|
|
|
<input type="text" id="lat" name="lat" readonly>
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<label for="lng">Longitude:</label><br>
|
|
|
|
|
<input type="text" id="lng" name="lng" readonly>
|
|
|
|
|
</p>
|
|
|
|
|
<p>{{ form.submit() }}</p>
|
|
|
|
|
</form>
|
|
|
|
|
<a href="{{ url_for('index') }}">Back to map</a>
|
|
|
|
|
|
|
|
|
|
<div id="map" style="height: 600px;"></div>
|
2024-08-18 00:38:09 +00:00
|
|
|
|
2024-08-17 19:05:28 +00:00
|
|
|
<script>
|
2024-08-18 00:38:09 +00:00
|
|
|
// Initial position of map and user pin
|
|
|
|
|
var map = L.map('map').setView([20.57, -100.38], 13);
|
|
|
|
|
var youarehere = L.marker([latlng.lat, latlng.lng]).addTo(map);
|
2024-08-17 19:05:28 +00:00
|
|
|
|
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
|
attribution: '© OpenStreetMap contributors'
|
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
|
|
map.on('click', function(e) {
|
|
|
|
|
var latlng = e.latlng;
|
|
|
|
|
document.getElementById('lat').value = latlng.lat;
|
|
|
|
|
document.getElementById('lng').value = latlng.lng;
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2024-08-18 00:38:09 +00:00
|
|
|
|
|
|
|
|
{% endblock %}
|