我正在使用此plugin来执行idw插值方法。但是当我使用自己的数据时,错误是" idw不是函数"
function idw(geojson) {
debugger;
coords = []; //define an array to store coordinates
onEachFeature: function (geojson.feature, geojsonLayer) {
// popupOptions = {maxWidth: 200};
// layer.bindPopup(feature.properties.popupContent);
coords.push(feature.geometry.coordinates);
}
for (var i=0; i<coords.length; i++) {
var lat = coords[i][0];
var lon = coords[i][1];
var intensity = coords[i][2];
var markerLocation = new L.LatLng(lat, lon);
var marker = new L.Marker(markerLocation).bindPopup(popupText).addTo(map);
}
var idw = L.idwLayer(coords, {
opacity: 0.3,
maxZoom: 18,
cellSize: 10,
exp: 3,
max: 1200
});
map.addLayer(idwLayer);
}
答案 0 :(得分:0)
我遇到了同样的问题,为了使其正常工作,我刚刚添加:
<script src="js/leaflet-idw+directdraw.js"></script>