Google maps 放置传单的自定义标记。绘制标记属性
我使用的是Floaple.draw插件,允许用户在地图上放置标记,但不确定如何在drawControl中配置以获取自定义图标、自定义宽度和自定义高度,尝试如下所示Google maps 放置传单的自定义标记。绘制标记属性,google-maps,leaflet,markers,leaflet.draw,Google Maps,Leaflet,Markers,Leaflet.draw,我使用的是Floaple.draw插件,允许用户在地图上放置标记,但不确定如何在drawControl中配置以获取自定义图标、自定义宽度和自定义高度,尝试如下所示 var drawControl = new L.Control.Draw({ draw : { position : 'topleft', polygon : { shapeOptions: {
var drawControl = new L.Control.Draw({
draw : {
position : 'topleft',
polygon : {
shapeOptions: {
color: 'red'
}
},
marker:{
iconUrl: 'http://joshuafrazier.info/images/firefox.svg'
},
polyline : false,
rectangle : {
shapeOptions: {
color: 'blue'
}
},
circle : false
},
edit: {
featureGroup: editableLayers, //REQUIRED!!
remove: true
}
});
但我还是得到了默认的标记,请在文档
http://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#l-latlngutil
我应该在哪里查看以了解配置和如何执行配置您需要为标记选项图标属性分配一个标记图标
L.icon
class创建自定义标记图标
var customMarker= L.Icon.extend({
options: {
shadowUrl: null,
iconAnchor: new L.Point(12, 12),
iconSize: new L.Point(24, 24),
iconUrl: 'http://joshuafrazier.info/images/firefox.svg'
}
});
customMarker
指定给标记图标属性
var drawControl = new L.Control.Draw({
draw : {
position : 'topleft',
polygon : {
shapeOptions: {
color: 'red'
}
},
marker: {
icon: new customMarker() //Here assign your custom marker
},
polyline : false,
rectangle : {
shapeOptions: {
color: 'blue'
}
},
circle : false
},
edit: {
featureGroup: editableLayers, //REQUIRED!!
remove: true
}
});