# Converting remote asset UDTs into dynamic map markers

**URL:** <https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 10, 2022, 9:41pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891 "2022-08-10T21:41:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Engsberg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sam_engsberg/32/37540_2.png) [@Sam\_Engsberg](https://forum.inductiveautomation.com/u/Sam_Engsberg)\
**Post date:** [August 10, 2022, 9:41pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/1 "2022-08-10T21:41:41Z")

</div>

I have a project that I am trying to proof of concept for a customer with Ignition. There are a number of large remote assets that run on construction sites, so their location is dynamic. I’d like to model all the assets with UDTs containing the location data and keep them in a single tag folder.

The screen I’d like to make uses the **Map** component. I’d like to do something akin to a forEach loop, grab each UDT (and their lat/lng), and turn them into markers.

Is there a way to loop through all the UDT’s in a folder and work off of them somehow? Scripting? I suppose I could create some database tables and keep the assets tied to coordinates in there. That seems a little convoluted though - maybe someone a better solution that’s a little more simple. Thanks for any help.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 10, 2022, 10:59pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/2 "2022-08-10T22:59:43Z")

</div>

[`system.tag.browse`](https://docs.inductiveautomation.com/display/DOC81/system.tag.browse) can be used for the ‘list UDT instances in a folder’ piece of this. There are some performance ramifications to be aware of, but a flat (non-recursive) browse of a single folder should be pretty safe.

---

<div class="post-metadata">

**Author:** ![Sam\_Engsberg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sam_engsberg/32/37540_2.png) [@Sam\_Engsberg](https://forum.inductiveautomation.com/u/Sam_Engsberg)\
**Post date:** [August 11, 2022, 2:55pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/3 "2022-08-11T14:55:58Z")

</div>

That’s a great start for it. I’m just getting into the scripting world, so that’s a really good springboard to get moving on. Thanks

---

<div class="post-metadata">

**Author:** ![Sam\_Engsberg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sam_engsberg/32/37540_2.png) [@Sam\_Engsberg](https://forum.inductiveautomation.com/u/Sam_Engsberg)\
**Post date:** [August 11, 2022, 10:21pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/4 "2022-08-11T22:21:52Z")

</div>

So after a fun day, I did get it working. The script browses the UDT folder and concocts markers after grabbing the relevant parts from the UDT.

I feel like I did it a bit hacky by using scripts and expression transforms on the marker tag binding. The issue I had to hack around was how to get the script to trigger and update. My solution was using a dummy query that would poll super lazily and eventually update things. Maybe I’ll find a better way to implement it, but it’s working for the proof of concept!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/9519afbd2fa18c07fd8083e3719d35ea58675f12.png)

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [August 11, 2022, 10:45pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/5 "2022-08-11T22:45:34Z")

</div>

Hey Sam,

Instead of using a dummy query, I would recommend switching to an expression structure binding.

You can have many inputs to the binding and use a single script transform. To make it poll, make one of the inputs a `now(x)` where x is the time, in milliseconds you want the poll rate to be

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f08a9e5dc058c64b893b180ba52733c52f1cdb93.png)

---

<div class="post-metadata">

**Author:** ![Sam\_Engsberg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sam_engsberg/32/37540_2.png) [@Sam\_Engsberg](https://forum.inductiveautomation.com/u/Sam_Engsberg)\
**Post date:** [August 12, 2022, 12:28am UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/6 "2022-08-12T00:28:40Z")

</div>

Ha. I originally had the expression structure binding going and switched it once I had the polling issue. That feels a bit less cobbled, thanks!

---

<div class="post-metadata">

**Author:** ![aramirez](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/aramirez/32/5283_2.png) [@aramirez](https://forum.inductiveautomation.com/u/aramirez)\
**Post date:** [April 3, 2024, 10:46pm UTC](https://forum.inductiveautomation.com/t/converting-remote-asset-udts-into-dynamic-map-markers/62891/7 "2024-04-03T22:46:37Z")

</div>

Sam,

I am a scripting begginer, and after looking at the image of your code it is very simmilar what I am looking to do using an script (adding markers on a map, based on UDT properties/values).  
Can you please share the complete code of your implementation... I am asking because the image is not showing all the code?

Thanks in advance!
