QQ交流群:607330463 GIS開發技術最強交流群
其實不只是焦點統計 鄰域分析包含的統計,這段代碼都可以改造
/// <summary>
/// 焦點統計:矩形鄰域分析
/// </summary>
/// <param name="geoDataset">輸入</param>
/// <param name="width">鄰域設定:寬度</param>
/// <param name="height">鄰域設定:高度</param>
/// <param name="unitsType">單位:像元 地圖(二選一)</param>
/// <param name="statisticsType">統計型別</param>
/// <returns>IGeoDataset</returns>
public IGeoDataset FocalStatistics(IGeoDataset geoDataset, double width, double height, esriGeoAnalysisUnitsEnum unitsType, esriGeoAnalysisStatisticsEnum statisticsType)
{
IRasterNeighborhood rasterNeighborhood = new RasterNeighborhoodClass();
rasterNeighborhood.SetRectangle(width, height, unitsType);//這里可選方法很多: 可以是矩形 圓形、環狀、扇形、及其他高級形狀(可查相關資料)
INeighborhoodOp neighborhoodOp = new RasterNeighborhoodOpClass();
IGeoDataset geoDataset_result = neighborhoodOp.FocalStatistics(geoDataset, statisticsType, rasterNeighborhood, true);
return geoDataset_result;//輸出
}

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/249429.html
標籤:其他
