代码拉取完成,页面将自动刷新
const fs = require('fs');
let geojsonStr = fs.readFileSync('indoor_3d_8.geojson');
let indoor_3d_geojson = JSON.parse(geojsonStr);
let features = indoor_3d_geojson.features;
features.forEach((feature)=>{
feature.geometry.coordinates.forEach((item)=>{
item.push(8*4+1);
})
feature.properties.SHAPE_Leng=feature.properties.SHAPE_Leng/1000;
});
let newfeatures = [];
let levelnum = 8;
let floorheight = 4;
let OBJECTID = features.length;
for(let i=0;i<levelnum;i++){
for(let j=0;j<features.length;j++){
let newfeature = JSON.parse(JSON.stringify(features[j]));//Object.assign({},features[j]);
newfeature.geometry.coordinates.forEach((item)=>{
item[2]=i*4+1;
})
newfeature.properties.Floor=i;
newfeature.properties.OBJECTID=OBJECTID;
OBJECTID++;
newfeatures.push(newfeature);
}
}
console.log('add floor done');
let indoor_poi_str = fs.readFileSync('PolyU_CoreM_poi_8.json');
let indoor_poi = JSON.parse(indoor_poi_str);
let pois = indoor_poi.features;
let lifts = pois.filter((poi)=>{
return poi.properties.Type=='Lift';
})
for(let i=0;i<levelnum;i++){
for(let j=0;j<lifts.length;j++){
let coords = lifts[j].geometry.coordinates;
let lift_line = {
"type" : "Feature",
"geometry" : {
"type" : "LineString",
"coordinates" : [
[ coords[0], coords[1], i*4+1 ],
[ coords[0], coords[1], (i+1)*4+1 ]
]
},
"properties" : {
"OBJECTID" : OBJECTID,
"Name" : "Lift"+j,
"Floor" : i,
"Type" : "Lift",
"BuildingID" : "PolyU_M",
"SHAPE_Leng" : 4
}
};
OBJECTID++;
newfeatures.push(lift_line);
}
}
console.log('add lifts done');
indoor_3d_geojson.features = indoor_3d_geojson.features.concat(newfeatures);
fs.writeFileSync('indoor_3d.geojson',JSON.stringify(indoor_3d_geojson));
console.log('done');
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。