# Changing icon pallet from CoT 2525C to OSM and show the correct Icon

**URL:** https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136
**Category:** General
**Tags:** function-node
**Created:** [18 May 2025 23:10 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136 "2025-05-18T23:10:46Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rivershark13](https://avatars.discourse-cdn.com/v4/letter/r/9d8465/32.png) [@rivershark13](https://discourse.nodered.org/u/rivershark13)
#### Post date: [18 May 2025 23:10 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/1 "2025-05-18T23:10:46Z")

</div>

After using node-red to inject an API key to input data onto the map we can modify the code to switch between unknown, friend, neutral, and hostile. When we try to use a different icon such as one from the OSM table transport icon the icon doesn’t change on the map and leaves one of the original 4 2525c icons. What do I need to change in the code to have new items from the api key show up as the transport icons?

```auto
var call = msg.payload.eventTime;
var alertid = msg.payload.alertId;
var lat = msg.payload.estimatedEventLocation[1];
var lon = msg.payload.estimatedEventLocation[2];
var headline = msg.payload.headline;
var remark = msg.payload.headline + ' ' + msg.payload.publicPost.link
const cinco = 10 * 60 * 1000;
const diez = 2 * cinco;
const stale = new Date(Date.now() + diez).toISOString();

/*
Not all fields are required for display on most TAK Products, other systems may
have different requirements. YMMV.
*/

msg.payload = {
    "event": {
        "_attributes": {
            "version": "2.0",
            "uid": call,
            "type": "a-h-G-I-i-e-icc",
            "how": "m-p",
            "time": new Date(Date.now()).toISOString(),
            "start": new Date(Date.now()).toISOString(),
            "stale": stale
        },
        "point": {
            "_attributes": {
                "lat": lat,
                "lon": lon,
                "hae": "0.0",
                "ce": "9999999.0",
                "le": "9999999.0"
            }
        },
        "detail": {
            "remarks": remark,
            "usericon": 'iconsetpath=6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png'

        }
        }
}

return msg;

```

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [19 May 2025 08:34 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/2 "2025-05-19T08:34:40Z")

</div>

Going to need a bit more information I think.  
How are you then converting that to xml and sending that to TAK ?  
can you show us the xml that is being sent ?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [19 May 2025 17:54 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/3 "2025-05-19T17:54:05Z")

</div>

If you are using the latest (0.15.0) version of my [TAK registration node](https://flows.nodered.org/node/node-red-contrib-tak-registration) then you can send a simple object to create the marker (values hardcoded just for demo)

```auto
msg.payload = {
    name : "Caution-001",
    lat: 52,
    lon: -1,
    icon:"6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png",
    SIDC: "SHGIIE",
    remarks: "Oops - something to look out for here."
}
return msg;

```

Example flow

```auto
[{"id":"d49875594dc11c84","type":"tcp request","z":"f66c5e7c660b2aec","name":"","server":"takserver","port":"8087","out":"sit","ret":"string","splitc":" ","newline":"</event>","trim":true,"tls":"","x":670,"y":1040,"wires":[["e3a6624c9fc609b7"]]},{"id":"58d89fb93ad8e764","type":"tak registration","z":"f66c5e7c660b2aec","name":"House","callsign":"CJ","group":"Cyan","role":"Gateway","latitude":"51.05","longitude":"-1.35","repeat":"60","dphost":"","x":570,"y":980,"wires":[["d49875594dc11c84","a078df188bc96e57"]]},{"id":"e3a6624c9fc609b7","type":"debug","z":"f66c5e7c660b2aec","name":"debug 14","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":860,"y":1040,"wires":[]},{"id":"327ef306fc571d89","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":940,"wires":[["15624f42e9a0cf31"]]},{"id":"15624f42e9a0cf31","type":"function","z":"f66c5e7c660b2aec","name":"function 6","func":"msg.payload = {\n name : \"Dave\",\n lat: 52,\n lon: -1,\n SIDC: \"SHGIIE\",\n remarks: \"Hey Dave\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":940,"wires":[["58d89fb93ad8e764"]]},{"id":"a078df188bc96e57","type":"debug","z":"f66c5e7c660b2aec","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":760,"y":980,"wires":[]},{"id":"6be38ff88df9b951","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":980,"wires":[["09c713fbc28e0501"]]},{"id":"09c713fbc28e0501","type":"function","z":"f66c5e7c660b2aec","name":"Caution","func":"msg.payload = {\n name : \"Caution-001\",\n lat: 52,\n lon: -1,\n icon:\"6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png\",\n SIDC: \"SHGIIE\",\n remarks: \"Oops - something to look out for here.\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":980,"wires":[["58d89fb93ad8e764"]]},{"id":"eab4981983d53f8b","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1020,"wires":[["59f08089f0f4c561"]]},{"id":"59f08089f0f4c561","type":"function","z":"f66c5e7c660b2aec","name":"Awacs","func":"msg.payload = {\n name : \"AWACS\",\n lat: 51,\n lon: -2,\n icon:\"6d180afb-89a6-4c07-b2b3-a89748b6a38f/FalconView/E-3.png\",\n SIDC: \"SFGPU-------\",\n remarks: \"I'm watching you\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":1020,"wires":[["58d89fb93ad8e764"]]},{"id":"4a017ece45e049ed","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1060,"wires":[["4bced043c53463b2"]]},{"id":"4bced043c53463b2","type":"function","z":"f66c5e7c660b2aec","name":"Fema - Destroyed","func":"msg.payload = {\n name : \"A10\",\n lat: 51,\n lon: -3,\n icon:\"f8f7f666-8b28-4b57-9fbb-e48e61d33b79/Iron Sites/Structure Destroyed.png\",\n SIDC: \"SFGPU-------\",\n remarks: \"Bang\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":1060,"wires":[["58d89fb93ad8e764"]]}]

```

---

<div class="post-metadata">

### Author: ![hhs99](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hhs99/32/100901_2.png) [@hhs99](https://discourse.nodered.org/u/hhs99)
#### Post date: [21 May 2025 01:17 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/4 "2025-05-21T01:17:02Z")

</div>

I am the one helping rivershark with this code on the server. How would we go about doing the stale and start times for it? I have everything else coded over to your module. btw big fan made my spaghetti code so much easier

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [21 May 2025 07:23 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/5 "2025-05-21T07:23:00Z")

</div>

Hi, start time is set to "now" when the message is sent. stale time can be set by setting msg.payload.ttl to a time to live in seconds - so based on your code above `msg.payload.ttl = 1200`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [19 August 2025 07:23 UTC](https://discourse.nodered.org/t/changing-icon-pallet-from-cot-2525c-to-osm-and-show-the-correct-icon/97136/6 "2025-08-19T07:23:57Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
