Google maps API

This is from @patrick:
The expression is correct, problem is that the data is not loaded when the map is ready.

Change the function to

function drawPath() {
  var map = document.getElementById('maps1').dmxComponent.map;
  var flightPlanCoordinates = dmx.parse('DestinationGeoFence.data.repeat1');
  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });

 flightPath.setMap(map);
}

Then on the DestinationGeoFence serverconnect component listen to the done or success event.

<dmx-serverconnect id="DestinationGeoFence" ondone="drawPath()" url="../../dmxConnect/a

I believe the issue was that I was activating the sever connect action after the map was loaded. I was doing this because I was selecting the geofence location from a table and displaying it in a modal. After trying Patrick’s solution is works beautifully.

Patrick,
Thank you so much for your assistance on this.

@Hyperbytes, thanks for your assistance as well.

1 Like