问题描述
我有一个包含大约 100 个多边形的 GeoJSON。我需要一种方法来过滤多个多边形并将它们溶解以放置在传单地图上。我想尝试使用 Turf.js,而不是使用溶解多边形创建新的 GeoJSON,而是尝试遵循他们的示例,但结果是空白且没有错误。缺少什么还是方法错误?
var poly = new L.layerGroup();
$.getJSON("/geodata/polygons.geojson",function(json) {
L.geoJson(json,{
turf: function(feature,latlng){
var select = (feature.properties.id >= 65 && feature.properties.id <= 68);
features = turf.featureCollection([select],{combine: 'yes'});
var dissolved = turf.dissolve(features,{propertyName: 'combine'}).addTo(poly);
}
});
});
来自草皮网站的溶解示例:
var features = turf.featureCollection([
turf.polygon([[[0,0],[0,1],[1,0]]],{combine: 'yes'}),turf.polygon([[[0,-1],-1]]],turf.polygon([[[1,[2,{combine: 'no'}),]);
var dissolved = turf.dissolve(features,{propertyName: 'combine'});
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)