angular - 如何在 agm-map 中制作自定义箭头标记?

标签 angular google-maps google-maps-api-3 google-maps-markers arrows

我正在构建一个车辆跟踪应用程序,我正在使用 agm-map-marker 来显示图像中这样定位的车辆, enter image description here

Livetracking.component.html 代码是,

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

这里我需要把标记替换成箭头,就像这张图一样,

enter image description here

我需要将标记更改为箭头,如第二张图片所示。请帮助我达到预期的结果。

最佳答案

接受的答案将无效,因为它们不是 agm-marker 的属性。

iconUrl 属性中,您可以使用以下任何类型:

字符串

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

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

例如,要使用具有所需大小的自定义图像标记(在本例中为 SVG),您可以在 [iconUrl] 属性中使用此对象:

{
    url: './assets/images/blue-marker.svg',
    scaledSize: {
        width: 40,
        height: 60
    }
}

关于angular - 如何在 agm-map 中制作自定义箭头标记?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46843606/

相关文章:

javascript - Google Map API - 如何在不刷新 map 的情况下过滤添加到 map 的标记?

Javascript/Google map API - "TypeError: undefined is not an object (evaluating ' 地址[x][0]')

google-maps - 无法从 Google Direction Service api 获得优化路线

javascript - 在 Angular 5 中使用 lodash.clonedeep 时出错

angular - 路由器在 Ionic 上导航,在 ios 上使用 Angular 动画闪烁动画

ios - 将 GMSAutocompleteViewController 设置为仅指定特定状态

java - 使用地理编码器根据纬度和经度检索地址会导致延迟。安卓

Angular 5 - Angular firebase - 测试 - 模拟 getDownloadURL 方法

html - Angular 点击事件绑定(bind)无法正常工作

Android - 一个应用程序中的两个 map