Cesium column - fill excavation analysis (with source code download)

Cesium is designed for three-dimensional map of the Earth and world-class open source JavaScript. It provides a development kit based on the JavaScript language, user-friendly Web applications to quickly build a zero Virtual Earth plug-in, and in performance, precision, and multi-platform rendering quality, ease of use have quality assurance.

About fill and cut analysis


Find Baidu Baike to the definition of fill and excavation are as follows:

Fill: filling means is higher than the original surface of the ground embankment, filling from the ground to the original volume of the surface portion of the earth and rock embankment.
Cut: refers to the subgrade below the original surface of the ground, to the surface of the roadbed from a cut-out portion of the original volume of earth and rock ground.

Jane book, but also to find a  basis of cut and fill Fang Pingheng GIS analysis  of the article, and gives practical operation in ArcGIS software.

This article describes important is how to calculate and fill in the excavation in Cesium, which will draw a small column in another article  Cesium column - profile analysis  of the content of the sample with respect to terrain height.

Note that: the calculation used herein is one of the most accurate calculation of line research program for the expansion of ideas, not, please evaluate with caution!

specific methods


1. Define topographical services, construction drawing area

  • // terrain before using the service, please set up Cesium.Ion.defaultAccessToken
  • var terrainProvider = Cesium.createWorldTerrain({
  • requestWaterMask: true,
  • requestVertexNormals: true
  • });
  •  
  • // define the excavation of fill height datum
  • excavateHeight = var 2300; // excavation height
  • buryHeight = var 6000; // height landfill
  •  
  • // define the construction area
  • var scope = [
  • Cesium.Cartesian3.fromDegrees( 99, 29),
  • Cesium.Cartesian3.fromDegrees( 100, 29),
  • Cesium.Cartesian3.fromDegrees( 100, 30),
  • Cesium.Cartesian3.fromDegrees( 99, 30)
  • ];

2. Split the construction area, calculate the area of ​​each region and the height of cut and fill

The core idea: the core idea of ​​computing excavation / landfill amount of excavation / fill amount is split calculus

  • // set the minimum unit of subdivision 0.01 °
  • subdivisionCell = var 0.01; // custom precision split
  • // store all the split rectangle
  • var subRectangles = [];
  • for (var i = 99; i <= 100; i = i + subdivisionCell) {
  • for (var j = 29; j <= 30; j = j + subdivisionCell) {
  • var subRectangle = new Cesium.Rectangle(
  • Cesium.Math.toRadians(i),
  • Cesium.Math.toRadians(j),
  • Cesium.Math.toRadians(i + subdivisionCell),
  • Cesium.Math.toRadians(j + subdivisionCell)
  • );
  • subRectangles.push(subRectangle);
  • }
  • }

  • // 计算每个矩形的中心点作为这个矩形的代表
  • var subRectanglesCenterPoints = [];
  • subRectangles.forEach( subRectangle => {
  • var centerPoint = Cesium.Cartographic.fromRadians((subRectangle.west + subRectangle.east) / 2, (subRectangle
  • .north +
  • subRectangle.south) / 2);
  • subRectanglesCenterPoints.push(centerPoint);
  • });
  • // 采样每个中心点到达地表的高度
  • var promise = Cesium.sampleTerrainMostDetailed(terrainProvider, subRectanglesCenterPoints);
  • Cesium.when(promise, function (updatedPositions) {
  • // 所有高度
  • var heights = [];
  • updatedPositions.forEach( point => {
  • heights.push(point.height);
  • });
  • });

3.计算填挖方

更多详情见下面链接文章

GIS之家小专栏此文章:Cesium专栏-填挖方分析(附源码下载)

文章提供源码,对本专栏感兴趣的话,可以关注一波

Guess you like

Origin www.cnblogs.com/giserhome/p/11374089.html