Javascript “过滤器显示”;“真的”;而不是传单上的通缉标签

Javascript “过滤器显示”;“真的”;而不是传单上的通缉标签,javascript,function,leaflet,collision,Javascript,Function,Leaflet,Collision,过滤掉某些数字,在传单中显示为标签。下面的代码确实过滤正确,但它没有显示正确的标签,它在地图上显示“true”,而不是通缉号码650到699。 需要进行哪些更改才能显示属性标签而不是此筛选中的“true” var local_points = new L.layerGroup(); function local (feature){ var filter = (feature.properties.local >= 650 && feature.p

过滤掉某些数字,在传单中显示为标签。下面的代码确实过滤正确,但它没有显示正确的标签,它在地图上显示“true”,而不是通缉号码650到699。 需要进行哪些更改才能显示属性标签而不是此筛选中的“true”

var local_points = new L.layerGroup();

    function local (feature){
        var filter = (feature.properties.local >= 650 && feature.properties.local < 699)
        return filter;
    };

var collisionlocal = L.LayerGroup.collision({margin:5});

$.getJSON("/geodata/localID_points.geojson", function(json) {

var points = L.geoJSON.collision(null, {
    pointToLayer: function(feature,latlng){
    label3s = String('<span class="textLabelclass3small">' + local(feature) + '</span>')
return new L.marker(latlng, {
        icon:createLabelIcon("textLabelclass3small",label3s)
        });
        }
    });

    var createLabelIcon = function(labelClass,labelText){
        return L.divIcon({ 
            className: labelClass,
            html: labelText
            });
        };

points.addData(json);
collisionlocal.addLayer(points);
collisionlocal.addTo(local_points);
var local_points=新的L.layerGroup();
功能本地(功能){
变量过滤器=(feature.properties.local>=650&&feature.properties.local<699)
回流过滤器;
};
var collisionlocal=L.LayerGroup.collision({margin:5});
$.getJSON(“/geodata/localID_points.geojson”),函数(json){
var points=L.geoJSON.collision(null{
pointToLayer:功能(特性、latlng){
label3s=字符串(“”+本地(特征)+“”)
返回新的L.标记(板条{
图标:createLabelIcon(“textLabelclass3small”,label3s)
});
}
});
var createLabelIcon=函数(labelClass,labelText){
返回L.divIcon({
类名:labelClass,
标签文本
});
};
addData(json);
collisionlocal.addLayer(点);
collisionlocal.addTo(本地_点);

}))

您需要将过滤器应用于geoJson调用,而不是文本:

var points = L.geoJSON.collision(null, {
    filter: local,
    pointToLayer: function(feature,latlng){
        label3s = String('<span class="textLabelclass3small">' + feature.properties.local + '</span>')
        return new L.marker(latlng, {
           icon:createLabelIcon("textLabelclass3small",label3s)
        });
     }
});
var points=L.geoJSON.collision(null{
过滤器:本地,
pointToLayer:功能(特性、latlng){
label3s=字符串(“”+feature.properties.local+“”)
返回新的L.标记(板条{
图标:createLabelIcon(“textLabelclass3small”,label3s)
});
}
});