我正在尝试使用$.getJSON函数过滤geoJSON数据,但是我被困在如何将数据过滤成我想要的内容,然后将其应用于geojson = data。
代码如下:
// Fetch the GeoJSON file
$.getJSON(config.geojson, function (data) {
geojson = data
features = $.map(geojson.features, function(feature) {
return feature.properties;
});
featureLayer.addData(data);
buildConfig();发布于 2018-04-19 21:01:26
要根据特定属性(如contractor === 'Tilson')过滤您的要素,请对其使用filter:
geojson = data.features.filter(function(feature) {
return feature.properties.contractor === 'Tilson';
});https://stackoverflow.com/questions/49787220
复制相似问题