を使用して、topojsonをgeojsonの機能に変換します。その後、標高に基づいてフィーチャをグループ化できます。 geojson-groupbyを使用して任意の属性に基づいてグループ化し、mutligeojsonを使用してジオメトリをMultiGeometryに結合することができます。
var features = [f1, f2, ..,fn]
var grouped = GeoJSONGroupBy(features, 'properties.elevation');
// grouped is
// {
// '100': [f1, f3, ..],
// '200': [f5, f8, f6, ..],
// ....
// }
var merged = {}; // final output merged with geometry and other attributes
Object.keys(grouped).reduce(function(merged,groupKey) {
var group = grouped[groupKey];
var reduced = {
geomCollection: []
attributes: {
elevation: group[0].attributes.elevation,
length: 0 // any other that you want to include
}
};
group.reduce(function(reduced, cur) {
reduced.geomCollection.push(cur.geometry);
reduced.attributes.length += length(cur.geometry); //length functon
},reduced);
return {
type: 'Feature',
geometry: multigeojson.implode(reduced.geomCollection),
attributes: reduced.attributes
}
},merged);