0
我正在使用传单应用,用户在其中绘制某些形状。 使用leaflet.polyline.decorators将多段线添加到该形状。 我只想知道如何将自定义标记传递给L.Symbol.marker()。如何将自定义标记传递给多段线装饰器
例如,我传递自定义标记,但它不工作。
脚本
var myCustomMarker= L.icon({
iconUrl: 'assets/img/wallE.png',
iconSize: [30, 30], // size of the icon
iconAnchor: [5, 18], // point of the icon which will correspond to marker's location
});
new L.Marker(e.latlng, { icon: wallIcon, draggable: false }).addTo(curr);
polylineWall.addLatLng([e.latlng.lat,e.latlng.lng]).addTo(curr);
// Add coordinate to the polyline
var decorator = L.polylineDecorator(polylineWall, {
patterns: [
{ offset: 0, endOffset: 0, repeat: '10px', symbol: new L.Symbol.marker(myCustomMarker)}
]
}).addTo(curr);
控制台错误
Uncaught Error: iconUrl not set in Icon options (see the docs).
如果有人对这个问题您的时间,请help.Thanks知识。
是的,完美的,谢谢你的帮助 –