Google Maps API V3中的Font Awesome图标作为标记

Google Maps API V3中的Font Awesome图标作为标记

问题描述:

我想使用谷歌地图标记的字体真棒图标。
这是我的代码:

I want to use a font awesome icon as Google Maps marker. Here is my code:

function addMarker(marker) {    
    marker1 = new google.maps.Marker({ 
    position: new google.maps.LatLng(obj.geo_lat,obj.geo_lng),
    category: obj.status,
    map: map,
    icon: // Font Awesome icon here
});

我看了这个问题,但不幸的是这不适合我。
我想知道是否有另一种方法可以做到这一点。

I've looked at this question, but unfortunately this is not working properly for me. I was wondering if there's another way to do this.

是的。您可以使用 RichMarker

示例:

Example:

function addMarker(marker) {    
        marker1 = new RichMarker({ 
            position: new google.maps.LatLng(obj.geo_lat,obj.geo_lng),
            category: obj.status,
            map: map,   
            draggable: false,
            flat:true,
            anchor: RichMarkerPosition.MIDDLE,
            content: '<i class="fa fa-map-marker fa-2x"></i>'
        });
}