我想在我的ionic2应用程序中的传单地图中绘制一个多边形,因为我发现了传单绘制插件,但我收到此错误 TypeError:L.Control.Draw不是构造函数
我的代码看起来很
this.map = L
.map("map")
.setView(this.latLng, 13)
.on("click", this.onMapClicked.bind(this))
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
.addTo(this.map);
this.marker = L
.marker(this.latLng, { draggable: true })
.on("dragend", this.onMarkerPositionChanged.bind(this))
.addTo(this.map);
var drawnItems = new L.FeatureGroup();
this.map.addLayer(drawnItems);
console.log(drawnItems);
var drawControl = new L.Control.Draw({
edit: {
featureGroup: drawnItems
}
});
this.map.addControl(drawControl);
答案 0 :(得分:8)
您需要添加到头部html CDN's
{ drawControl: true }
并添加到地图var map = L.map('mapid', { drawControl: true }).setView([25, 25], 2);
String[] tempStringArray = temp1.split("[,.!;:\\s]+");
答案 1 :(得分:0)
您可以从该地址获取leaflet.draw
的最新版本
https://cdnjs.com/libraries/leaflet.draw
https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css
https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js
答案 2 :(得分:0)