bb01e9a06c
## Summary - **ADS-B & AIS:** OpenSky and AISStream OSINT feeds upsert into the CoT store; tactical tracks still arrive via adsbcot/aiscot on `:8089`. Map clients subscribe via `GET /api/cot/stream` (SSE) with viewport bbox filtering and Air / Surface / Team layer toggles. - **ALPR (Flock/OSM):** Toggleable license-plate reader layer sourced from OpenStreetMap, with SQLite cache, Overpass fallback, tiled viewport fetching, and clustered markers with direction cones. - **Map performance:** Ring-based tile selection (fixes zoom-out crash), immutable tile cache, incremental marker sync, split cluster load/query, and padded SSE bbox to reduce reconnect churn. ## Docs - `docs/tracking.md` — ADS-B/AIS accuracy tiers, freshness, self-hosted receivers, optional OSINT API keys - `docs/map-and-cameras.md` — ALPR layer and map behavior updates --------- Co-authored-by: Madison Grubb <madison@elastiflow.com> Reviewed-on: #36
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import {
|
|
entitiesToFeatures,
|
|
getCotClusters,
|
|
loadCotCluster,
|
|
} from '../../app/utils/cotMapLayer.js'
|
|
|
|
function makeEntities(n, centerLat = 37.7, centerLng = -122.4) {
|
|
return Array.from({ length: n }, (_, i) => ({
|
|
id: `ICAO.${i}`,
|
|
lat: centerLat + (i % 10) * 0.01,
|
|
lng: centerLng + Math.floor(i / 10) * 0.01,
|
|
type: 'a-f-A-C-F',
|
|
label: `AC${i}`,
|
|
}))
|
|
}
|
|
|
|
describe('cotMapLayer', () => {
|
|
it('converts entities to GeoJSON points', () => {
|
|
const features = entitiesToFeatures([
|
|
{ id: 'ICAO.1', lat: 37.7, lng: -122.4, type: 'a-f-A-C-F' },
|
|
{ id: 'bad', lat: 'x', lng: 0 },
|
|
])
|
|
expect(features).toHaveLength(1)
|
|
expect(features[0].geometry.coordinates).toEqual([-122.4, 37.7])
|
|
expect(features[0].properties.entity.id).toBe('ICAO.1')
|
|
})
|
|
|
|
it('clusters dense tracks at low zoom', () => {
|
|
loadCotCluster(makeEntities(50))
|
|
const view = { west: -123, south: 37, east: -122, north: 38, zoom: 6 }
|
|
const clusters = getCotClusters(view)
|
|
const clusterCount = clusters.filter(f => f.properties?.cluster).length
|
|
const pointCount = clusters.filter(f => !f.properties?.cluster).length
|
|
expect(clusterCount).toBeGreaterThan(0)
|
|
expect(clusterCount + pointCount).toBeLessThan(50)
|
|
})
|
|
|
|
it('shows individual markers at high zoom', () => {
|
|
loadCotCluster(makeEntities(20))
|
|
const view = { west: -123, south: 37, east: -122, north: 38, zoom: 15 }
|
|
const clusters = getCotClusters(view)
|
|
expect(clusters.every(f => !f.properties?.cluster)).toBe(true)
|
|
expect(clusters).toHaveLength(20)
|
|
})
|
|
})
|