Leaflet + Mapbox:在地图框标记上使用自定义图标?

时间:2015-11-13 00:21:05

标签: leaflet mapbox

是否可以使用地图框simplestyle spec使用自定义图标?这就是我要做的事情:

var myPoint = L.geoJson(myCollection, {
    filter: function(feature,latlng){
        switch: (feature.properties.category){
            case 'Auto Manufacturers' : return true; break;
                return false; break;
        }
    },
    pointToLayer: function(feature, latlng){
    L.extend(feature.properties, {
        'marker-color': '#009688',
        //this maki icon works but I need to use my own custom icon
        //'marker-symbol': 'car'
        'icon': {
            'iconUrl': 'images/carIcon.png'
        }
    });
    return L.mapbox.marker.style(feature,latlng);
   }
});

不幸的是,使用上面显示的自定义图标不起作用。如果我也可以简单地做'marker-symbol': '/images/carIcon.png',那将是很好的,但这也不行。

我的目标是轻松更改标记的十六进制颜色代码,并在该标记的顶部添加自定义png图标。

0 个答案:

没有答案
相关问题