12345678910111213141516171819202122232425262728293031323334353637 |
- // 排水接混接点标注_L
- const fs = require('fs');
- const wuShuiColor = "#931795"; // 紫色
- const yuanGuan = 310000;
- /**
- * 找不到横截面数据全部按圆管处理半径0.8
- * @param {*} inFilePath
- * @param {*} outFilePath
- */
- function readLineFile(inFilePath, outFilePath) {
- try {
- // 同步读取GeoJSON文件
- const data = fs.readFileSync(inFilePath, 'utf8');
- // 解析GeoJSON数据
- const geojson = JSON.parse(data);
- for (let i = 0; i < geojson.features.length; i++) {
- let feature = geojson.features[i];
- // 圆管
- geojson.features[i].properties["符号风格"] = yuanGuan
- geojson.features[i].properties["符号颜色"] = wuShuiColor
- geojson.features[i].properties["x长"] = 0.1
- geojson.features[i].properties["x宽"] =0.1
- }
- // 同步写入GeoJSON文件
- fs.writeFileSync(outFilePath, JSON.stringify(geojson, null, 2));
- console.log('GeoJSON文件已成功保存');
- } catch (err) {
- console.error('操作GeoJSON文件时出错:', err);
- }
- }
- readLineFile("./data/guanxian/排水混接点标注/原始数据/排水混接点标注_L.geojson", "./data/guanxian/排水混接点标注/符号字段/排水混接点标注_L.geojson");
|