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).
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?