08-26-2019 01:15 PM
I have a map on my dashboard that I want to bind locations to a function of a tag coming from my cRIO device. The cRIO reports a string that is associated with a given location. This location is what needs to be bound, which will be properly formatted in the [Latitude, Longitude] format that the map expects. I've seen the concept of virtual tags, but I've not been able to figure out how to use them in order to link a Marker on the map to a longitude/latitude position.
For example. If my cRIO device reports:
cRIO.location = "Chicago"
I think I would need to setup a virtual tag that is a function of the input string so that I get (see function below):
cRIO.LongLat = "[41.88, -87.63]"
Then I understand that I would need to setup my map such that my marker was bound to my cRIO.LongLat virtual tag.
Is my understanding correct, and any thoughts on how to make this work. I'm also posting my Virtual Tag script here for more transparency.
def Interpretted_Location(inputTag0):
switch(inputTag0) {
case "Chicago": outputTag0 = "[41.88, -87.63]";
break;
default: outputTag0 = "[35, -70]";
break;
}
return [outputTag0]
Final question: Do I also need an event script to make this work? I'm unsure how this ties in, but the documentation seems to suggest I do.