日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

DEM挖填方分析--基于水平参考面计算

發布時間:2024/1/23 编程问答 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DEM挖填方分析--基于水平参考面计算 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

基于水平參考高程面計算挖填方比較簡單,水平參考高程也就是某一個高程值,只需要計算同一位置上DEM高程到參考面高程即可,挖填方分析實際上就是計算DEM數據與參考面構成的封閉體體積。

DEM數據本身是由一系列等間距橫向和縱向分布的高程點構成,其數據組成形式與一般圖像類似,相當于每個圖像坐標上由像素值變成高程值。一般tif格式DEM數據還附帶一個tfw文件用以描述起始點坐標、橫向和縱向間隔距離等信息,通過讀取tfw文件可以更方便的計算DEM數據。

由于DEM數據為離散的高程數據,為了得到更精確的計算結果,需要對DEM數據進行內插,在DEM內部內插出更多的高程點形成更小的高程格網,以每個格網內高程點作為附近區域平均高程與參考面高程計算差值,并計算體積。當差值為正,此時需要將高出參考面部分挖去,差值即為需要挖掉的深度,通過差值與高程點所在格網面積計算的體積即為該格網處的挖方;當差值為負,此處高程低于參考面,需要進行填方計算,通過同樣方式計算填方量。

整個實現過程主要分為三步:

第一步,讀取DEM數據,獲取每一個柵格的高程值,讀取tfw文件,獲取起始坐標和每一個柵格長度;

Tfw文件內容:

第二步,對DEM高程值進行內插計算,將每一個柵格分割為n*n的格網,通過雙線性內插計算得到格網上每個點的高程值;

第三步,將每個格網上的高程值與參考面高程計算差值,通過單個格網面積計算得到挖填方結果。

具體實現:

public DigFillResultData analysisByElevation(File currentDEM,double referenceElevation,int interpolation) throws Exception{// 讀取數據File currentDEMTfw = new File(currentDEM.toString().replace("tif", "tfw"));TfwInfo currentDEMInfo = new TfwReader().read(currentDEMTfw);DemData currentData = new DemReader().read(currentDEM);// 進行計算DigFillResultData result = computeByElevation( currentDEMInfo, currentData,referenceElevation, interpolation);return result;}private DigFillResultData computeByElevation(TfwInfo currentDEMInfo,DemData currentData,double referenceElevation,int interpolation) {double maxDigDeep = 0.0;double maxFillDeep = 0.0;double digVolume = 0.0;double fillVolume = 0.0;int width = currentData.getWidth();int height = currentData.getHeight();DigFillResultData result = new DigFillResultData();for (int i = 0; i < height - 1; i++) {for (int j = 0; j < width - 1; j++) {double currentXCoordinate = currentDEMInfo.getxCoordinate() + j * currentDEMInfo.getxStep();double currentYCoordinate = currentDEMInfo.getyCoordinate() + i * currentDEMInfo.getyStep();double interXStep = currentDEMInfo.getxStep() / interpolation;double interYStep = currentDEMInfo.getyStep() / interpolation;for (int x = 0; x < interpolation; x++) {for (int y = 0; y < interpolation; y++) {double currentXInterCoord = currentXCoordinate + x * interXStep;double currentYInterCoord = currentYCoordinate + y * interYStep;double currentValue = new ElevationInterpolation().caculateElevation(currentXInterCoord,currentYInterCoord, currentData, currentDEMInfo);if (currentValue != -32767.0) {double difference = currentValue - referenceElevation;if (difference > 0) {if (difference > maxDigDeep) {maxDigDeep = difference;}digVolume += difference * interXStep * Math.abs(interYStep);}if (difference < 0) {if (Math.abs(difference) > maxFillDeep) {maxFillDeep = Math.abs(difference);}fillVolume += Math.abs(difference) * interXStep * Math.abs(interYStep);}}}}}}result.setDigVolume(format(digVolume));result.setFillVolume(format(fillVolume));result.setMaxDigDeep(format(maxDigDeep));result.setMaxFillDeep(format(maxFillDeep));return result;}

?

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的DEM挖填方分析--基于水平参考面计算的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。