6.9.1 • Published 13 days ago

@tak-ps/node-cot v6.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

Lightweight JavaScript library for parsing and manipulating TAK related messages, primarily Cursor-on-Target (COT)

About

node-cot converts between TAK message protocols and a Javascript object/JSON format. It also can bidirectionally convert CoT messages into GeoJSON

Installation

NPM

To install node-cot with npm run

npm install @tak-ps/node-cot

CoT Spec

The CoT Spec is very informally developed by rough internal concensus of large TAK Clients within the TPC (TAK Product Center). The following is a current understanding of the spec primarily developed through reverse engineering TAK clients

<event version uid type how time start stale/>

Event Attributes

NameDescriptionExample
versionCoT Version, currently 2.0version="2.0"
uidGlobally unique name for this information on this eventuid="any-unique-string-123"
typeHierarchically organized hint about event type`type="a-f-G-E"'
howGives a hint about how the coordinates were generatedhow=""
timeThe time at which the event was generatedtime="2023-07-18T15:25:09.00Z"
startThe time at which the event starts or is relevantstart="2023-07-18T15:25:09.00Z"
staleThe time at which the event ends or is not relevantstale="2023-07-18T15:25:09.00Z"

CoT GeoJSON Spec

One of the primary use-cases of this library is to make serialization and deserialiation from more commmon geospatial formats a breeze. This section will walk through CoT options that are exposed via the from_geojson() function.

Supported Geometries

  • All Input Geometries must be a GeoJSON Feature type
  • Point, Polygon, and LineString are all supported
  • Multi Geometries are not supported and must be cast to their non-multi type before being passed to the library
  • Centroids are calulated using a PointOnSurface algorithm

Supported Properties

The following are the most important/relevant properties

PropertyDescription
.idUsed as the CoT uid - If omitted a UUID is generated
.properties.typeCoT type - note this will be overridden if geometry is not a Point
.properties.howCoT how
.properties.timeTime at which CoT was created
.properties.startTime at which CoT is relevant
.properties.staleTime at which CoT expires
.properties.callsignDisplayed callsign (basically the name of the feature)
.properties.speedSpeed in m/s of the object
.properties.courseCourse in degrees from north of the object
.properties.remarksHuman readable remarks field

Styles can also be applied to features using the following

PropertyDescription
.properties.strokePolygon/LineString
.properties.stroke-opacityPolygon/LineString: Int from 0-256
.properties.stroke-widthPolygon/LineString
.properties.stroke-stylePolygon/LineString
.properties.stroke-stylePolygon/LineString
.properties.fillPolygon
.properties.fill-opacityPolygon: Int from 0-256

These are less common properties that can be used:

PropertyDescription
.properties.iconString: Custom Icon Path (string)
.properties.archivedBoolean: TAK Clients will ignore the stale value and retain the feature
.properties.destMarti API Instructions for sending CoTs to a specific location
.properties.filesharePush Data Packages via CoT

Usage Examples

Basic Usage

import CoT from '@tak-ps/node-cot';

const message = '<event version="2.0" uid="ANDROID-deadbeef" type="a-f-G-U-C" how="m-g" time="2021-02-27T20:32:24.771Z" start="2021-02-27T20:32:24.771Z" stale="2021-02-27T20:38:39.771Z"><point lat="1.234567" lon="-3.141592" hae="-25.7" ce="9.9" le="9999999.0"/><detail><takv os="29" version="4.0.0.0 (deadbeef).1234567890-CIV" device="Some Android Device" platform="ATAK-CIV"/><contact xmppUsername="xmpp@host.com" endpoint="*:-1:stcp" callsign="JENNY"/><uid Droid="JENNY"/><precisionlocation altsrc="GPS" geopointsrc="GPS"/><__group role="Team Member" name="Cyan"/><status battery="78"/><track course="80.24833892285461" speed="0.0"/></detail></event>'

const cot = new CoT(message);

// Export Formats
cot.to_geojson(); // Output GeoJSON Representation
cot.to_xml(); // Output String XML Representation

cot.raw; // JSON XML Representation

Known Special CoT Types

The following list is a very incomplete list of "special" CoT types and behaviors

CoT TypeNotes
u-d-fLineString or Polygon
u-d-r4 Cornered Rectangle
b-a-o-tbl911 Alert
b-a-o-canCancel
b-a-gGeoFenceBreach
b-a-o-panRingTheBell
b-a-o-opnTroopsInContact
b-t-fChat
b-t-f-dChat delivery receipt
b-t-f-rChat read receipt
b-t-f-pChat pending receipt
b-t-f-sChat delivery failure
t-x-m-c-lMission Change Notification
t-x-m-iMission Invite Notification
6.8.0

13 days ago

6.9.0

13 days ago

6.9.1

13 days ago

6.6.0

14 days ago

6.7.0

14 days ago

6.5.0

16 days ago

6.4.0

16 days ago

6.3.3

16 days ago

6.2.1

17 days ago

6.2.0

17 days ago

6.2.2

17 days ago

6.1.0

20 days ago

6.0.0

20 days ago

5.5.1

22 days ago

5.5.0

22 days ago

5.6.1

22 days ago

5.6.0

22 days ago

5.4.0

23 days ago

5.7.1

22 days ago

5.3.1

3 months ago

5.3.0

3 months ago

5.1.1

3 months ago

5.1.0

3 months ago

5.0.6

3 months ago

5.0.5

3 months ago

5.0.3

3 months ago

5.0.2

3 months ago

5.0.1

3 months ago

5.0.0

3 months ago

4.6.0

4 months ago

4.5.1

4 months ago

4.5.0

5 months ago

4.4.1

5 months ago

4.4.0

5 months ago

4.4.2

5 months ago

3.5.4

10 months ago

3.5.3

10 months ago

4.1.0

9 months ago

4.0.0

10 months ago

4.3.0

6 months ago

4.2.1

6 months ago

4.1.2

6 months ago

4.2.0

6 months ago

4.1.1

6 months ago

3.5.2

11 months ago

3.5.1

11 months ago

3.5.0

12 months ago

3.4.0

1 year ago

3.4.3

1 year ago

3.4.2

1 year ago

3.4.1

1 year ago

3.3.0

1 year ago

3.2.0

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago

3.0.0

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.5.0

1 year ago

2.4.0

1 year ago

2.7.0

1 year ago

2.6.0

1 year ago

2.8.1

1 year ago

2.8.0

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago