angulargoogle-mapsgoogle-maps-api-3google-maps-markersarrows

How to make custom arrow mark in agm-map?


I am building a vehicle tracking application and i am using agm-map-marker to display the vehicles that were located like this in the image, enter image description here

And Livetracking.component.html code is,

<agm-map #gm [latitude]="lat" [longitude]="lng" [(zoom)]="zoom" [mapTypeControl]="true">
            <agm-marker class="mapMarker" *ngFor="let device of devices;"
                [latitude]="device.latitude" [longitude]="device.longitude"
                (markerClick)="gm.lastOpen?.close(); gm.lastOpen = infoWindow;mapMarkerInfo(m);">
            </agm-marker>
</agm-map>

Here i need to replace the marker into arrows, exactly as like in this image,

enter image description here

I am in the need of changing the marker to arrow as like in the second image..Kindly help me to achieve the desired result..


Solution

  • You can use the existing api and set the iconUrl

    <agm-marker
       [latitude]="location.latitude"
       [longitude]="location.longitude"
       [iconAnchorX]="10"
       [iconAnchorY]="10"
       [iconHeight]="20"
       [iconWidth]="20">
       [iconUrl]="location.icon">
     </agm-marker>