PIE SDK克里金插值法

 

1.算法功能簡介

    克里金插值法基於通常最小二乘法的隨機插值技術沒用方差圖做爲權重函數,被應用於任何點數據估計其在地表上分佈的現象,被稱爲空間自協方差最佳插值法,是一種最優內插法也是一種最經常使用的空間插值算法,例如地質學中的地下水位和土壤溼度的採樣;環境科學研究中的大氣污染(例如臭氧)和土壤污染物的研究;以及大氣科學中的近地面風場、氣溫、降水等的單點觀測。算法

 

    PIE支持算法功能的執行,下面對等值線生成算法功能進行介紹。ide

2.算法功能實現說明

2.1. 實現步驟

第一步函數

算法參數設置工具

第二步測試

算法執行spa

第三步code

結果顯示視頻

2.2. 算法參數

C#算法DLLblog

PIE.CommonAlgo.dll教程

C#算法名稱

PIE.CommonAlgo. KrigingInterpolationAlgo

參數結構體

KrigingInterpolation_Exchange_Info

參數說明

CellSize

double

像元大小

FieldIndex

Int

字段索引

Height

Int

輸出柵格高

Width

int

輸出柵格寬度

InputFeatureDataset

IFeatureDataset

輸入數據集

OutputRasterDataset

IRasterDataset

輸出數據集

OutputRasterFilePath

string

輸出的柵格數據文件路徑(*.tif;*.tiff) 【輸出信息】

OutputRasterType

string

輸出柵格類型

SearchMaxDis

double

搜索最大距離

SearchPoints

int

搜索點數

2.3. 示例代碼

數據路徑

百度雲盤地址下/PIE示例數據/矢量數據/Shape/省會城市.shp

視頻路徑

百度雲盤地址下/PIE視頻教程/10.算法調用/實用工具/克里金插值算.avi

示例代碼

 1          /// <summary>
 2         /// 克里金插值算法測試
 3         /// </summary>
 4         private void Test_KrigingInterpolationAlgo()
 5         {
 6             #region 一、參數設置
 7             string strFileName = @"D:\\data\\China\\省會城市.shp";
 8             IFeatureDataset fDataset = PIE.DataSource.DatasetFactory.OpenFeatureDataset(strFileName);
 9             if (fDataset.GetGeomType() != GeometryType.GeometryPoint) return;
10             KrigingInterpolation_Exchange_Info info = new KrigingInterpolation_Exchange_Info();
11             info.InputFeatureDataset = fDataset;
12             info.FieldIndex = 1;
13             info.SearchPoints = 20;
14             info.OutputRasterFilePath = @"D:\\temp\\省會城市克里金插值測試.tiff";
15             info.OutputRasterType = "GTIFF";
16             info.Width = 1000;
17             info.CellSize = fDataset.GetExtent().GetWidth() / info.Width;
18             //info.CellSize = fDataset.GetExtent().GetWidth() / 100;
19             #endregion
20             //二、算法執行
21             PIE.CommonAlgo.KrigingInterpolationAlgo alog = new KrigingInterpolationAlgo();
22             alog.Params = info;
23             bool result = alog.Execute();
24             int errCode = -1;
25             string errMsg = string.Empty;
26             alog.GetErrorInfo(ref errCode, ref errMsg);
27             //三、結果顯示
28             ILayer layer = LayerFactory.CreateDefaultLayer(info.OutputRasterFilePath);
29             if (layer == null)
30             {
31                 MessageBox.Show("執行失敗");
32                 return;
33             }       
34             m_HookHelper.FocusMap.AddLayer(layer);     m_HookHelper.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
35             (fDataset as IDisposable).Dispose();
36             fDataset = null;
37         }
View Code

2.4. 示例截圖

相關文章
相關標籤/搜索