欢迎观看一起学习进步
程序员文章站
2022-05-22 09:45:57
...
Arc Engine 三维坡度坡向
第一次写博客,已经完成自己的二开大作业,之前坡度坡向在网上一直搜不到,也当是记录一下。
效果图
原Dem
点击菜单栏的选项
坡度分析结果
坡向分析结果图
在窗体放了一下下拉菜单可以选择和获取你选择的图层
坡向坡向代码如下
//坡度
IRasterLayer pRasterLayer = new RasterLayerClass();
IGeoDataset pGeoDataset;
int i = comboBox4.SelectedIndex;
object zFactor;
pRasterLayer = (IRasterLayer)mainMapControl.get_Layer(i);
string layerN = mainMapControl.get_Layer(2).Name;
IRaster pIRaster = pRasterLayer.Raster;
ISurfaceOp pSurfaceOp = new RasterSurfaceOpClass();
zFactor = 1;
pGeoDataset = pSurfaceOp.Slope((IGeoDataset)pIRaster, esriGeoAnalysisSlopeEnum.esriGeoAnalysisSlopeDegrees, ref zFactor);
IRasterLayer pRasterLayer1 = new RasterLayerClass();
IRaster praster = new Raster();
praster = (IRaster)pGeoDataset;
ShowRasterResult(pGeoDataset, "坡度");
mainMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
axTOCControl1.Update();
//坡向
IRasterLayer pRasterLayer = new RasterLayerClass();
IGeoDataset pGeoDataset;
int i = comboBox4.SelectedIndex;
object zFactor;
pRasterLayer = (IRasterLayer)mainMapControl.get_Layer(i);
string layerN = mainMapControl.get_Layer(2).Name;
IRaster pIRaster = pRasterLayer.Raster;
ISurfaceOp pSurfaceOp = new RasterSurfaceOpClass();
//zFactor = 1;
pGeoDataset = pSurfaceOp.Aspect((IGeoDataset)pIRaster);
IRasterLayer pRasterLayer1 = new RasterLayerClass();
IRaster praster = new Raster();
praster = (IRaster)pGeoDataset;
ShowRasterResult(pGeoDataset, "坡向");
mainMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
axTOCControl1.Update();
上一篇: 码绘——我的自画像