以下的代码可以实现通过调用GP将TIN转成GRID,当然,其中的具体参数可以传入,模拟ArcMap中的参数设置就可以了。
实现代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 |
private void funTinToGrid(ITinLayer pTinLayer, string strGridPath) { try { Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true ; TinRaster tinToRaster = new TinRaster(); tinToRaster.in_tin = pTinLayer; tinToRaster.out_raster = strGridPath; tinToRaster.data_type = "FLOAT" ; tinToRaster.method = "LINEAR" ; tinToRaster.sample_distance = "OBSERVATIONS 1500" ; gp.Execute(tinToRaster, null ); MessageBox.Show( "转换完成" ); } catch (Exception e) { MessageBox.Show( "转换失败,原因如下:" + e.Message.ToString()); } } |