Perspective map refresh, v.8.0.5

On my map marker binding I have a direct tag binding to my dataset tag. I then use a script transform with the following code:

marker =
pydata = system.dataset.toPyDataSet(value)
for row in pydata:
if row[‘Lat’] and row[‘Long’] != None:
alarmer = system.alarm.queryStatus(priority=[0,1], state=[“ActiveUnacked”], source = [""+row[‘tagPath’]+"/Raw_sensor"])
if len(alarmer)>0:
colores= ‘#FA2904
elif len(alarmer) == 0:
colores = ‘#4190F7
icon = {‘path’:‘material/location_on’,‘size’:{},‘color’:colores}
tooltip = {“content”: {“text”:row[‘tagPath’],“view”: {“path”: “”,“params”: {}}},“direction”: “auto”,“permanent”: False,“sticky”: False,“opacity”: 1}
popup = {‘enabled’:False,‘content’:{‘text’:’’,‘view’:{‘path’:‘Popup/Hei’,‘params’:{‘tagPath’:row[‘tagPath’]}}},‘width’:{‘max’:300,‘min’:50},‘height’:{},‘pan’:{‘auto’:False},‘closeButton’:True,‘autoClose’:False,‘closeOnEscapeKey’:True}
marker.append({‘lat’:float(row[‘Lat’]),‘lng’:float(row[‘Long’]),‘opacity’:1,‘riseOnHover’:False,‘riseOffset’:250,‘icon’:icon,‘tooltip’:tooltip,‘popup’:popup})
return marker

For those stations that have an alarm, the marker color needs to be red.
So I need to update the markers on the map, say each 5 seconds, so that the operator can see the faulted stations (see figure under).

mapPerspective

I tried adding an expression transform like:

if({[default]refreshMap},{value},{value})

Where the refreshMap is a boolean memory tag toggled by a gateway script each 5 second.

This updates the markers like I need, but it also cause the current popups in the sessions to close.

Any ideas on how to update the markers, and in the same time not close the current popups in the sessions?

1 Like

Hi,
Try to add binding to this tag, which will run tag update script. Read statuses and add to the needed marker’s icon color new value. Maybe this will help. for start time u can use now() and for end time - now(500) . it looks like message Handler, but in my logic I used script :slight_smile:

1 Like

Thanks for your reply.

I solved this by looping through my dataset in a tag change script each 5 second via a custom property, and updating only the marker colors instead of the entire marker binding. In this way the popups in the session did not close, and everything seems to be working well.

Oh ok! that’s great!
PS! I update colors also :slight_smile:
How did u implement the looping function every 5 seconds? using now(5000) or what?

By using a GW timer script that toggled my custom property, causing the tag change script to trigger.

1 Like