Add ADS-B, AIS, and ALPR map layers with live CoT streaming.
Ingest aircraft and vessel tracks via OSINT feeds and tactical CoT, expose viewport-filtered SSE to the map, and add an OSM ALPR layer with tiled caching and performant marker sync.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user