|
| 1 | +import test from 'tape'; |
| 2 | +import { CoTParser } from '../index.js'; |
| 3 | + |
| 4 | +test('Parse b-m-p-s-m (Spotted)', async (t) => { |
| 5 | + const cot = CoTParser.from_xml(` |
| 6 | + <event version='2.0' uid='9405e320-9356-41c4-8449-f46990aa17f8' type='b-m-p-s-m' time='2020-12-16T19:59:34.913Z' start='2020-12-16T19:59:34.913Z' stale='2021-01-02T20:40:03.841Z' how='h-g-i-g-o'> |
| 7 | + <point lat='38.85606343062312' lon='-77.0563755018233' hae='9999999.0' ce='9999999.0' le='9999999.0' /> |
| 8 | + <detail> |
| 9 | + <status readiness='true'/> |
| 10 | + <archive/> |
| 11 | + <link uid='ANDROID-589520ccfcd20f01' production_time='2020-12-16T19:51:09.603Z' type='a-f-G-U-C' parent_callsign='HOPE' relation='p-p'/> |
| 12 | + <contact callsign='R 1'/> |
| 13 | + <remarks></remarks> |
| 14 | + <archive/> |
| 15 | + <color argb='-65536'/> |
| 16 | + <precisionlocation altsrc='???'/> |
| 17 | + <usericon iconsetpath='COT_MAPPING_SPOTMAP/b-m-p-s-m/-65536'/> |
| 18 | + </detail> |
| 19 | + </event> |
| 20 | + `); |
| 21 | + |
| 22 | + t.deepEquals(await CoTParser.to_geojson(cot), { |
| 23 | + id: '9405e320-9356-41c4-8449-f46990aa17f8', |
| 24 | + type: 'Feature', |
| 25 | + path: '/', |
| 26 | + properties: { |
| 27 | + callsign: 'R 1', |
| 28 | + center: [ -77.0563755018233, 38.85606343062312, 9999999 ], |
| 29 | + type: 'b-m-p-s-m', |
| 30 | + how: 'h-g-i-g-o', |
| 31 | + time: '2020-12-16T19:59:34.913Z', |
| 32 | + start: '2020-12-16T19:59:34.913Z', |
| 33 | + stale: '2021-01-02T20:40:03.841Z', |
| 34 | + archived: true, |
| 35 | + status: { readiness: 'true' }, |
| 36 | + precisionlocation: { altsrc: '???' }, |
| 37 | + 'marker-color': '#FF0000', |
| 38 | + 'marker-opacity': 1, |
| 39 | + metadata: {} |
| 40 | + }, |
| 41 | + geometry: { |
| 42 | + type: 'Point', |
| 43 | + coordinates: [ -77.0563755018233, 38.85606343062312, 9999999 ] |
| 44 | + }, |
| 45 | + }); |
| 46 | + |
| 47 | + t.end(); |
| 48 | +}); |
0 commit comments