|
|
|
@@ -16,10 +16,10 @@
|
|
|
|
|
}
|
|
|
|
|
.topbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:3.5rem; }.brand { display:flex; align-items:center; gap:.7rem; color:var(--ink); font-size:.9rem; font-weight:800; letter-spacing:.1em; text-decoration:none; text-transform:uppercase; }.brand-mark { display:grid; width:2.25rem; aspect-ratio:1; place-items:center; border-radius:.75rem; color:#141022; background:linear-gradient(135deg,#fcd34d,#fb7185); box-shadow:0 .5rem 1.5rem #fb718550; }.nav { display:flex; gap:.35rem; padding:.25rem; border:1px solid var(--line); border-radius:.75rem; background:#111a31a6; }.nav a { padding:.5rem .75rem; border-radius:.5rem; color:var(--muted); font-size:.86rem; font-weight:700; text-decoration:none; }.nav a[aria-current="page"] { color:var(--ink); background:#2a3b67; }
|
|
|
|
|
.kicker { margin:0 0 .65rem; color:#bfdbfe; font-size:.76rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase; }.headline { display:flex; align-items:end; justify-content:space-between; gap:2rem; margin-bottom:2rem; }.headline h1 { margin:0; font-size:clamp(2.3rem,5vw,4.5rem); line-height:.98; letter-spacing:-.06em; }.headline p { max-width:30rem; margin:0; color:var(--muted); line-height:1.6; }
|
|
|
|
|
.filters { display:grid; grid-template-columns:1.3fr repeat(3,minmax(8rem,1fr)) auto; gap:.75rem; align-items:end; margin-bottom:1rem; padding:1rem; border:1px solid var(--line); border-radius:1.1rem; background:#121d37d9; box-shadow:0 1rem 3rem #03071466; }.filter { display:grid; gap:.35rem; }.filter label { color:#9fb1d5; font-size:.7rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }.filter select,.filter input { width:100%; min-height:2.65rem; border:1px solid #354a77; border-radius:.65rem; padding:0 .75rem; color:var(--ink); font:inherit; background:#0c1428; }.filter select:focus,.filter input:focus { outline:2px solid #82b5ff; outline-offset:2px; }.mock-tag { align-self:center; padding:.46rem .65rem; border:1px solid #4a5f8e; border-radius:999px; color:#c9d8f6; font-size:.75rem; font-weight:700; white-space:nowrap; background:#1d2b4e; }
|
|
|
|
|
.map-panel { overflow:hidden; border:1px solid var(--line); border-radius:1.25rem; background:var(--surface); box-shadow:0 1.5rem 4rem #0206168a; }.map-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.2rem; border-bottom:1px solid var(--line); }.map-header strong { font-size:.95rem; }.live { display:flex; align-items:center; gap:.45rem; color:#a7f3d0; font-size:.8rem; }.live i { width:.5rem; height:.5rem; border-radius:50%; background:var(--green); box-shadow:0 0 0 .25rem #34d3992e; }.map-wrap { position:relative; }.map { height:clamp(30rem,65vh,45rem); background:#dce4cf; }.legend { position:absolute; z-index:600; right:1rem; bottom:1rem; width:min(15rem,calc(100% - 2rem)); padding:.85rem; border:1px solid #344973; border-radius:.8rem; color:#dce7fe; font-size:.78rem; background:#101a31e8; box-shadow:0 .75rem 2rem #05091480; backdrop-filter:blur(10px); }.legend h2 { margin:0 0 .6rem; font-size:.82rem; }.legend div { display:flex; align-items:center; gap:.5rem; margin-top:.4rem; }.legend-dot { width:.7rem; height:.7rem; border:2px solid #f2c56b; border-radius:50%; background:#ed8e2e88; }.legend-ring { width:.85rem; height:.85rem; border:2px solid #a98af7; border-radius:50%; background:#8b5cf633; }.legend-line { width:1.1rem; border-top:2px dashed #644b9c; }.sensor-icon { display:grid; width:2.1rem; height:2.1rem; place-items:center; border:2px solid #e6edff; border-radius:50%; color:#14203b; font-size:.72rem; font-weight:900; background:linear-gradient(135deg,#a5c8ff,#c4b5fd); box-shadow:0 .2rem .8rem #18275080; }.source-icon { display:grid; width:2.45rem; height:2.45rem; place-items:center; border:2px solid #fff3d5; border-radius:50% 50% 50% 0; color:#452000; font-size:1.15rem; background:#f7a52f; box-shadow:0 .3rem 1rem #a84f2670; transform:rotate(-45deg); }.source-icon span { transform:rotate(45deg); }.direction-arrow { display:block; color:#5c408d; font-size:1.5rem; font-weight:900; line-height:1; text-shadow:0 .1rem .4rem #fff8; }
|
|
|
|
|
.leaflet-control-zoom a { color:#243456!important; }.leaflet-popup-content-wrapper,.leaflet-popup-tip { color:#e9f1ff; background:#14203a; }.leaflet-popup-content { margin:.75rem .9rem; font-family:inherit; }.popup-title { display:block; margin-bottom:.2rem; font-weight:800; }.popup-meta { color:#a9b9d8; font-size:.78rem; }
|
|
|
|
|
@media (max-width:52rem) { .shell { width:min(100% - 1.25rem,80rem); }.topbar { margin-bottom:2.5rem; }.headline { align-items:start; flex-direction:column; gap:1rem; }.filters { grid-template-columns:1fr 1fr; }.filters .filter:first-child { grid-column:1/-1; }.mock-tag { justify-self:start; }.map { height:32rem; } }
|
|
|
|
|
.filters { display:grid; grid-template-columns:repeat(5,minmax(8rem,1fr)) auto auto; gap:.75rem; align-items:end; margin-bottom:1rem; padding:1rem; border:1px solid var(--line); border-radius:1.1rem; background:#121d37d9; box-shadow:0 1rem 3rem #03071466; }.filter { display:grid; gap:.35rem; }.filter label { color:#9fb1d5; font-size:.7rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }.filter select,.filter input { width:100%; min-height:2.65rem; border:1px solid #354a77; border-radius:.65rem; padding:0 .75rem; color:var(--ink); font:inherit; background:#0c1428; }.filter select:focus,.filter input:focus { outline:2px solid #82b5ff; outline-offset:2px; }.filter-submit { min-height:2.65rem; border:1px solid #8ab7ff; border-radius:.65rem; padding:0 1rem; color:#101a31; font:inherit; font-weight:800; background:#b9d6ff; cursor:pointer; }.map-tag { align-self:center; padding:.46rem .65rem; border:1px solid #4a5f8e; border-radius:999px; color:#c9d8f6; font-size:.75rem; font-weight:700; white-space:nowrap; background:#1d2b4e; }
|
|
|
|
|
.map-panel { overflow:hidden; border:1px solid var(--line); border-radius:1.25rem; background:var(--surface); box-shadow:0 1.5rem 4rem #0206168a; }.map-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.2rem; border-bottom:1px solid var(--line); }.map-header strong { font-size:.95rem; }.live { display:flex; align-items:center; gap:.45rem; color:#a7f3d0; font-size:.8rem; }.live i { width:.5rem; height:.5rem; border-radius:50%; background:var(--green); box-shadow:0 0 0 .25rem #34d3992e; }.map-wrap { position:relative; }.map { height:clamp(30rem,65vh,45rem); background:#dce4cf; }.legend { position:absolute; z-index:600; right:1rem; bottom:1rem; width:min(15rem,calc(100% - 2rem)); padding:.85rem; border:1px solid #344973; border-radius:.8rem; color:#dce7fe; font-size:.78rem; background:#101a31e8; box-shadow:0 .75rem 2rem #05091480; backdrop-filter:blur(10px); }.legend h2 { margin:0 0 .6rem; font-size:.82rem; }.legend div { display:flex; align-items:center; gap:.5rem; margin-top:.4rem; }.legend-dot { width:.7rem; height:.7rem; border:2px solid #f2c56b; border-radius:50%; background:#ed8e2e88; }.legend-ring { width:.85rem; height:.85rem; border:2px solid #a98af7; border-radius:50%; background:#8b5cf633; }.legend-line { width:1.1rem; border-top:2px dashed #644b9c; }.report-icon { display:grid; width:2.3rem; height:2.3rem; place-items:center; border:2px solid #fff3d5; border-radius:50%; color:#452000; font-size:1rem; font-weight:900; background:#f7a52f; box-shadow:0 .3rem 1rem #a84f2670; }.source-icon { display:grid; width:2.45rem; height:2.45rem; place-items:center; border:2px solid #fff3d5; border-radius:50% 50% 50% 0; color:#452000; font-size:1.15rem; background:#f7a52f; box-shadow:0 .3rem 1rem #a84f2670; transform:rotate(-45deg); }.source-icon span { transform:rotate(45deg); }.direction-marker { display:grid; width:3.5rem; height:3.5rem; place-items:center; border:3px solid #fff7e6; border-radius:50%; color:#fff; background:#6d45a0; box-shadow:0 .3rem 1rem #281642b3; }.direction-marker span { display:block; font-size:2.45rem; font-weight:950; line-height:1; text-shadow:0 .1rem .25rem #1e1136; transform-origin:center; }
|
|
|
|
|
.map-compass { position:relative; width:5rem; height:5rem; border:2px solid #eaf1ff; border-radius:50%; color:#f7fbff; font-size:.72rem; font-weight:900; background:#111a31e8; box-shadow:0 .5rem 1.5rem #05091480; backdrop-filter:blur(8px); }.map-compass span { position:absolute; display:grid; place-items:center; }.map-compass .compass-n { top:.35rem; left:50%; transform:translateX(-50%); color:#ffd18c; }.map-compass .compass-e { top:50%; right:.45rem; transform:translateY(-50%); }.map-compass .compass-s { bottom:.35rem; left:50%; transform:translateX(-50%); }.map-compass .compass-w { top:50%; left:.45rem; transform:translateY(-50%); }.map-compass .compass-needle { top:1.3rem; left:50%; color:#ffd18c; font-size:2rem; line-height:1; transform:translateX(-50%); text-shadow:0 .1rem .35rem #3b1b48; }.leaflet-control-zoom a { color:#243456!important; }.leaflet-popup-content-wrapper,.leaflet-popup-tip { color:#e9f1ff; background:#14203a; }.leaflet-popup-content { margin:.75rem .9rem; font-family:inherit; }.popup-title { display:block; margin-bottom:.2rem; font-weight:800; }.popup-meta { color:#a9b9d8; font-size:.78rem; }
|
|
|
|
|
@media (max-width:52rem) { .shell { width:min(100% - 1.25rem,80rem); }.topbar { margin-bottom:2.5rem; }.headline { align-items:start; flex-direction:column; gap:1rem; }.filters { grid-template-columns:1fr 1fr; }.filters .filter:first-child { grid-column:1/-1; }.map { height:32rem; } }
|
|
|
|
|
@media (max-width:30rem) { .nav a { padding:.5rem; }.filters { grid-template-columns:1fr; }.filters .filter:first-child { grid-column:auto; } }
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
@@ -34,59 +34,125 @@
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<section class="headline" aria-labelledby="map-title">
|
|
|
|
|
<div><p class="kicker">Future event intelligence</p><h1 id="map-title">Sound activity map.</h1></div>
|
|
|
|
|
<p>A concept view of sensors triangulating a likely source. This uses entirely mock data for Heerenveen, ready for future incoming event records.</p>
|
|
|
|
|
<div><p class="kicker">Manual report intelligence</p><h1 id="map-title">Sound activity map.</h1></div>
|
|
|
|
|
<p>Reviewed manual reports with a captured location appear as their H3 cell, not their precise coordinates. Saved phone compass readings show the reported direction of the sound.</p>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="filters" aria-label="Mock event filters">
|
|
|
|
|
<div class="filter"><label for="event-type">Event type</label><select id="event-type"><option>All sound events</option><option>Possible fireworks</option><option>Privacy-filtered speech</option></select></div>
|
|
|
|
|
<div class="filter"><label for="from-date">From</label><input id="from-date" type="date" value="2026-09-19"></div>
|
|
|
|
|
<div class="filter"><label for="range">Range</label><select id="range"><option>This week</option><option>Today</option><option>Last 30 days</option></select></div>
|
|
|
|
|
<div class="filter"><label for="confidence">Confidence</label><select id="confidence"><option>Any confidence</option><option>High confidence</option><option>Review needed</option></select></div>
|
|
|
|
|
<span class="mock-tag">Mock data</span>
|
|
|
|
|
</section>
|
|
|
|
|
<form class="filters" method="get" action="{% url 'fireworks_detect:map' %}" aria-label="Map filters">
|
|
|
|
|
<div class="filter"><label for="event-source">Source</label><select id="event-source" disabled><option selected>Manual reports</option><option>Sensor events — coming soon</option></select></div>
|
|
|
|
|
<div class="filter"><label for="range">Period</label><select id="range" name="range"><option value="7" {% if map_filters.range == "7" %}selected{% endif %}>Last 7 days</option><option value="14" {% if map_filters.range == "14" %}selected{% endif %}>Last 2 weeks</option><option value="30" {% if map_filters.range == "30" %}selected{% endif %}>Last 30 days</option><option value="all" {% if map_filters.range == "all" %}selected{% endif %}>All time</option><option value="custom" {% if map_filters.range == "custom" %}selected{% endif %}>Custom range</option></select></div>
|
|
|
|
|
<div class="filter"><label for="from-date">From</label><input id="from-date" name="from" type="date" value="{{ map_filters.date_from }}"></div>
|
|
|
|
|
<div class="filter"><label for="to-date">To</label><input id="to-date" name="to" type="date" value="{{ map_filters.date_to }}"></div>
|
|
|
|
|
<div class="filter"><label for="visual">Visual confirmation</label><select id="visual" name="visual"><option value="all" {% if map_filters.visual == "all" %}selected{% endif %}>Any report</option><option value="yes" {% if map_filters.visual == "yes" %}selected{% endif %}>Visually confirmed</option><option value="no" {% if map_filters.visual == "no" %}selected{% endif %}>Not visually confirmed</option></select></div>
|
|
|
|
|
<button class="filter-submit" type="submit">Apply filters</button>
|
|
|
|
|
<span class="map-tag">{{ mapped_event_count }} report{{ mapped_event_count|pluralize }}</span>
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
<section class="map-panel" aria-label="Mock sound event map of Heerenveen">
|
|
|
|
|
<div class="map-header"><strong>Heerenveen, Netherlands</strong><span class="live"><i></i> 3 sensors simulated</span></div>
|
|
|
|
|
<div class="map-wrap"><div id="event-map" class="map" aria-label="Interactive map centered on Heerenveen"></div>
|
|
|
|
|
<aside class="legend" aria-label="Map legend"><h2>Triangulation estimate</h2><div><span class="legend-dot"></span> Higher-confidence source area</div><div><span class="legend-ring"></span> Broader possible area</div><div><span class="legend-line"></span> Simulated direction of arrival</div></aside>
|
|
|
|
|
<section class="map-panel" aria-label="Manual fireworks report map">
|
|
|
|
|
<div class="map-header"><strong>Manual reports · privacy-preserving H3 cells</strong><span class="live"><i></i> H3 resolution {{ h3_resolution }} · sensor layer disabled</span></div>
|
|
|
|
|
<div class="map-wrap"><div id="event-map" class="map" aria-label="Interactive map of manual fireworks reports"></div>
|
|
|
|
|
<aside class="legend" aria-label="Map legend"><h2>Manual reports</h2><div><span class="legend-dot"></span> Report marker at H3-cell centre</div><div><span class="legend-ring"></span> H3 cell (resolution {{ h3_resolution }})</div><div><span class="legend-line"></span> Saved compass direction</div></aside>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
{{ h3_cells|json_script:"h3-cells-data" }}
|
|
|
|
|
{{ map_events|json_script:"map-events-data" }}
|
|
|
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
const map = L.map('event-map', { zoomControl: false, scrollWheelZoom: false }).setView([52.9512478, 5.943674], 14);
|
|
|
|
|
L.control.zoom({ position: 'bottomleft' }).addTo(map);
|
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png', {
|
|
|
|
|
const map = L.map("event-map", { zoomControl: false, scrollWheelZoom: false }).setView([52.1326, 5.2913], 7);
|
|
|
|
|
L.control.zoom({ position: "bottomleft" }).addTo(map);
|
|
|
|
|
const compassControl = L.control({ position: "topright" });
|
|
|
|
|
compassControl.onAdd = () => {
|
|
|
|
|
const compass = L.DomUtil.create("div", "map-compass");
|
|
|
|
|
compass.setAttribute("role", "img");
|
|
|
|
|
compass.setAttribute("aria-label", "Map compass: north is up");
|
|
|
|
|
compass.innerHTML = "<span class=\"compass-n\">N</span><span class=\"compass-e\">E</span><span class=\"compass-s\">S</span><span class=\"compass-w\">W</span><span class=\"compass-needle\">↑</span>";
|
|
|
|
|
L.DomEvent.disableClickPropagation(compass);
|
|
|
|
|
return compass;
|
|
|
|
|
};
|
|
|
|
|
compassControl.addTo(map);
|
|
|
|
|
L.tileLayer("https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png", {
|
|
|
|
|
maxZoom: 18,
|
|
|
|
|
attribution: '© OpenStreetMap contributors',
|
|
|
|
|
attribution: "© OpenStreetMap contributors",
|
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
|
|
const estimatedSource = [52.9501, 5.9466];
|
|
|
|
|
const sensors = [
|
|
|
|
|
{ name: 'Sensor 1', position: [52.9570, 5.9335], confidence: '91% direction confidence' },
|
|
|
|
|
{ name: 'Sensor 2', position: [52.9586, 5.9508], confidence: '86% direction confidence' },
|
|
|
|
|
{ name: 'Sensor 3', position: [52.9458, 5.9370], confidence: '78% direction confidence' },
|
|
|
|
|
];
|
|
|
|
|
const h3Cells = JSON.parse(document.getElementById("h3-cells-data").textContent);
|
|
|
|
|
const reports = JSON.parse(document.getElementById("map-events-data").textContent);
|
|
|
|
|
const bounds = L.latLngBounds([]);
|
|
|
|
|
|
|
|
|
|
L.circle(estimatedSource, { radius: 1020, color: '#8b5cf6', weight: 1.5, fillColor: '#8b5cf6', fillOpacity: 0.10, dashArray: '5 8' }).addTo(map);
|
|
|
|
|
L.circle(estimatedSource, { radius: 370, color: '#f59e0b', weight: 2, fillColor: '#f59e0b', fillOpacity: 0.28 }).addTo(map);
|
|
|
|
|
const sourceIcon = L.divIcon({ className: '', html: '<div class="source-icon"><span>✦</span></div>', iconSize: [39, 39], iconAnchor: [20, 32] });
|
|
|
|
|
L.marker(estimatedSource, { icon: sourceIcon }).addTo(map).bindPopup('<span class="popup-title">Estimated sound source</span><span class="popup-meta">High-confidence area · mock event</span>');
|
|
|
|
|
h3Cells.forEach((cell) => {
|
|
|
|
|
const polygon = L.polygon(cell.boundary, {
|
|
|
|
|
color: "#f59e0b", weight: 2, fillColor: "#f59e0b", fillOpacity: 0.25,
|
|
|
|
|
}).addTo(map);
|
|
|
|
|
polygon.bindPopup(
|
|
|
|
|
"<span class=\"popup-title\">H3 " + cell.cell + "</span>" +
|
|
|
|
|
"<span class=\"popup-meta\">" + cell.reports + " reports · " + cell.occurrences +
|
|
|
|
|
" occurrences · resolution {{ h3_resolution }}</span>"
|
|
|
|
|
);
|
|
|
|
|
bounds.extend(L.latLngBounds(cell.boundary));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function bearing(from, to) {
|
|
|
|
|
const lat = ((from[0] + to[0]) / 2) * Math.PI / 180;
|
|
|
|
|
return Math.atan2((to[1] - from[1]) * Math.cos(lat), to[0] - from[0]) * 180 / Math.PI;
|
|
|
|
|
function cardinalDirection(degrees) {
|
|
|
|
|
const directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
|
|
|
|
|
return directions[Math.floor(((degrees + 22.5) % 360) / 45)];
|
|
|
|
|
}
|
|
|
|
|
sensors.forEach((sensor, index) => {
|
|
|
|
|
const line = L.polyline([sensor.position, estimatedSource], { color: '#60438f', weight: 2, opacity: 0.85, dashArray: '8 9' }).addTo(map);
|
|
|
|
|
line.bindTooltip('Direction of arrival', { sticky: true });
|
|
|
|
|
const arrowPosition = [sensor.position[0] + (estimatedSource[0] - sensor.position[0]) * 0.58, sensor.position[1] + (estimatedSource[1] - sensor.position[1]) * 0.58];
|
|
|
|
|
const arrowIcon = L.divIcon({ className: '', html: `<span class="direction-arrow" style="transform:rotate(${bearing(sensor.position, estimatedSource)}deg)">↑</span>`, iconSize: [22, 22], iconAnchor: [11, 11] });
|
|
|
|
|
L.marker(arrowPosition, { icon: arrowIcon, interactive: false }).addTo(map);
|
|
|
|
|
const sensorIcon = L.divIcon({ className: '', html: `<div class="sensor-icon">${index + 1}</div>`, iconSize: [34, 34], iconAnchor: [17, 17] });
|
|
|
|
|
L.marker(sensor.position, { icon: sensorIcon }).addTo(map).bindPopup(`<span class="popup-title">${sensor.name}</span><span class="popup-meta">${sensor.confidence}<br>Mock microphone node</span>`);
|
|
|
|
|
|
|
|
|
|
function destinationPoint(origin, bearingDegrees, distanceMetres) {
|
|
|
|
|
const earthRadius = 6378137;
|
|
|
|
|
const bearing = bearingDegrees * Math.PI / 180;
|
|
|
|
|
const latitude = origin[0] * Math.PI / 180;
|
|
|
|
|
const longitude = origin[1] * Math.PI / 180;
|
|
|
|
|
const angularDistance = distanceMetres / earthRadius;
|
|
|
|
|
const targetLatitude = Math.asin(
|
|
|
|
|
Math.sin(latitude) * Math.cos(angularDistance) +
|
|
|
|
|
Math.cos(latitude) * Math.sin(angularDistance) * Math.cos(bearing)
|
|
|
|
|
);
|
|
|
|
|
const targetLongitude = longitude + Math.atan2(
|
|
|
|
|
Math.sin(bearing) * Math.sin(angularDistance) * Math.cos(latitude),
|
|
|
|
|
Math.cos(angularDistance) - Math.sin(latitude) * Math.sin(targetLatitude)
|
|
|
|
|
);
|
|
|
|
|
return [targetLatitude * 180 / Math.PI, targetLongitude * 180 / Math.PI];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const reportIcon = L.divIcon({
|
|
|
|
|
className: "", html: "<div class=\"report-icon\">✦</div>", iconSize: [37, 37], iconAnchor: [19, 19],
|
|
|
|
|
});
|
|
|
|
|
reports.forEach((report) => {
|
|
|
|
|
const visualStatus = report.visually_confirmed ? "Visually confirmed" : "Not visually confirmed";
|
|
|
|
|
let detail = report.occurrences + " occurrence" + (report.occurrences === 1 ? "" : "s") +
|
|
|
|
|
" · " + visualStatus + "<br>Reported " + report.reported_on;
|
|
|
|
|
if (report.direction_degrees !== null) {
|
|
|
|
|
detail += "<br>Compass direction " + Math.round(report.direction_degrees) + "° (" + cardinalDirection(report.direction_degrees) + ")";
|
|
|
|
|
if (report.direction_accuracy_degrees !== null) {
|
|
|
|
|
detail += " (±" + Math.round(report.direction_accuracy_degrees) + "°)";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
L.marker(report.center, { icon: reportIcon }).addTo(map).bindPopup(
|
|
|
|
|
"<span class=\"popup-title\">Manual report · H3 " + report.cell + "</span>" +
|
|
|
|
|
"<span class=\"popup-meta\">" + detail + "</span>"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (report.direction_degrees !== null) {
|
|
|
|
|
const arrowEnd = destinationPoint(report.center, report.direction_degrees, 900);
|
|
|
|
|
L.polyline([report.center, arrowEnd], { color: "#fff7e6", weight: 9, opacity: 0.8 }).addTo(map);
|
|
|
|
|
L.polyline([report.center, arrowEnd], { color: "#6d45a0", weight: 5, opacity: 1 }).addTo(map);
|
|
|
|
|
const arrowIcon = L.divIcon({
|
|
|
|
|
className: "",
|
|
|
|
|
html: "<div class=\"direction-marker\"><span style=\"transform:rotate(" + report.direction_degrees + "deg)\">↑</span></div>",
|
|
|
|
|
iconSize: [56, 56], iconAnchor: [28, 28],
|
|
|
|
|
});
|
|
|
|
|
L.marker(arrowEnd, { icon: arrowIcon, interactive: false }).addTo(map);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (bounds.isValid()) {
|
|
|
|
|
map.fitBounds(bounds.pad(0.18));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const range = document.getElementById("range");
|
|
|
|
|
document.querySelectorAll("#from-date, #to-date").forEach((input) => {
|
|
|
|
|
input.addEventListener("change", () => { range.value = "custom"; });
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|