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

而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>这里我需要将标记替换为箭头,就像这张图一样,

我需要将标记更改为箭头,就像在第二个image..Kindly中一样,帮助我获得所需的结果。
发布于 2017-10-20 14:47:19
您可以使用已有的接口,设置
<agm-marker
[latitude]="location.latitude"
[longitude]="location.longitude"
[iconAnchorX]="10"
[iconAnchorY]="10"
[iconHeight]="20"
[iconWidth]="20">
[iconUrl]="location.icon">
</agm-marker>发布于 2018-06-12 16:55:52
可接受的答案将不起作用,因为这些不是agm-marker的属性。
在iconUrl属性中,您可以使用以下任何类型:
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
例如,要使用具有所需大小的自定义图像标记(本例中为SVG),可以在[iconUrl]属性中使用此对象:
{
url: './assets/images/blue-marker.svg',
scaledSize: {
width: 40,
height: 60
}
}发布于 2019-12-09 13:37:35
你必须包括在项目中的agm覆盖,然后你可以过度绘制,它也提供了支持添加自定义div地图。
<agm-overlay
*ngFor="let driver of driversList"
[latitude]="driver.latitude"
[longitude]="driver.longitude"
>
<div>
<img
style="cursor: pointer;"
[ngClass]="{
online: driver.status === 'online',
offline: driver.status === 'offline'
}"
src="{{
driver.profileImageURL
}}"
/>
</div>
</agm-overlay>将此添加到css文件中
.online {边框: 3px纯黑}

https://stackoverflow.com/questions/46843606
复制相似问题