Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 484
Maniraj Murugan Avatar asked Oct 20 '17 06:10

Maniraj Murugan


People also ask

How do you zoom on a AGM map?

All you have to do is put the lowest latitude to the latitue map (not the agm-marker but the agm-map). and the Highest longitude to the agm-map. It will automatically center and adjust itself Whatever zoom level you have.


Video Answer


1 Answers

The accepted answer will not work because those aren't properties of the agm-marker.

Inside iconUrl property you can use any of these types:

string

Icon: https://developers.google.com/maps/documentation/javascript/reference/3.exp/marker#Icon

Symbol: https://developers.google.com/maps/documentation/javascript/reference/3.exp/marker#Symbol

For example, to use a custom image marker (SVG in this case) with desired size you can use this object in the [iconUrl] property:

{
    url: './assets/images/blue-marker.svg',
    scaledSize: {
        width: 40,
        height: 60
    }
}
like image 135
Daniel López Avatar answered Sep 21 '22 21:09

Daniel López