const fs = require('fs');
function readFile(inFilePath, outFilePath) {
    try {
        // 同步读取GeoJSON文件
        const data = fs.readFileSync(inFilePath, 'utf8');

        // 解析GeoJSON数据
        const geojson = JSON.parse(data);

        for (let i = 0; i < 20; i++) {
            geojson.features.push(JSON.parse(JSON.stringify(geojson.features[0])));
        }
        for (let i = 0; i < geojson.features.length; i++) {
            geojson.features[i].properties["楼层"] = i + 1;
            geojson.features[i].properties["层高"] = 3;
            geojson.features[i].properties["高程"] = i * 3;
        }
        fs.writeFileSync(outFilePath, JSON.stringify(geojson, null, 2));
        console.log("输出")
    } catch (err) {
        console.error('操作GeoJSON文件时出错:', err);
    }
}

// readFile("./data/building/left_build.json", "./data/building/left_build1.json")
readFile("./data/building/right_build.json", "./data/building/right_build1.json")