Map marker in perspective

Your vehicle data structure is different to the original post. We need to modify:

Map - custom.vehicleStatus
[
  {
    "latitude": 42.472783,
    "longitude": -2.40938,
    "name": "05-RIO-MENDA"
  },
  {
    "latitude": 42.789632,
    "longitude": -1.639813,
    "name": "05-NAV-CORDO"
  },
  {
    "latitude": 41.624986,
    "longitude": -4.735528,
    "name": "05-CAL-FORJA"
  },
  {
    "latitude": 40.96796,
    "longitude": -5.661133,
    "name": "05-CAL-RINCO"
  }
]
Map - custom.sampleMarker
{
  "enabled": true,
  "event": {
    "stopPropagation": false
  },
  "icon": {
    "color": "#4190F7",
    "path": "material/location_on",
    "rotate": 0,
    "size": {
      "height": 36,
      "width": 36
    },
    "style": {
      "classes": ""
    }
  },
  "lat": 25.938225,
  "lng": 49.938877,
  "name": "marker0",
  "opacity": 1,
  "popup": {
    "autoClose": true,
    "closeButton": true,
    "closeOnClick": null,
    "closeOnEscapeKey": true,
    "content": {
      "text": "",
      "view": {
        "params": {},
        "path": ""
      }
    },
    "enabled": false,
    "height": {
      "max": null
    },
    "pan": {
      "auto": true
    },
    "width": {
      "max": 300,
      "min": 50
    }
  },
  "properties": {},
  "tooltip": {
    "content": {
      "text": "5956 XJR",
      "view": {
        "params": {},
        "path": ""
      }
    },
    "direction": "auto",
    "opacity": 1,
    "permanent": false,
    "sticky": false
  }
}
Map - script transform on ui.marker property binding
def transform(self, value, quality, timestamp):

	def recursiveCopy(original):
		# With credit to https://forum.inductiveautomation.com/u/lrose
		# https://forum.inductiveautomation.com/t/copy-dictionary-and-modify-it-without-affecting-the-original/62297/9
	    from copy import deepcopy
	    from com.inductiveautomation.ignition.common.script.abc import AbstractMutableJythonMap,AbstractMutableJythonSequence
	
	    if isinstance(original,AbstractMutableJythonMap):
	        return {key:recursiveCopy(value) for key,value in original.iteritems()}
	
	    if isinstance(original,AbstractMutableJythonSequence):
	        return [recursiveCopy(item) for item in original]
	
	    return deepcopy(original)
	
	markers = []
	for car in value:
		protoMarker = recursiveCopy(self.custom.sampleMarker)
		protoMarker['lat'] = car['latitude']
		protoMarker['lng'] = car['longitude']
		protoMarker['tooltip']['content']['text'] = car['name']
		markers.append(protoMarker)
	return markers

Figure 4.

Figure 5.

1 Like