栅格表面分析等值线坡度坡向AEC
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
栅格表面分析--等值线,坡度,坡向(AE+C#)
?using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Analyst3D;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesGDB;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.GeoAnalyst;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
/*
* 表面分析ArcEngine + C#
* 2011.3.10 xyj
* wxuyongjun@
*
* */
namespace SpatialAnalysis.Surface_Analysis
{
class SurfaceCommonFunction
{
/// <summary>
/// 创建等值线
/// </summary>
/// <param name="raster"></param>栅格集
/// <param name="contourList"></param>等值间隔
/// <param name="smooth"></param>是否平滑
/// <param name="maxDeviation"></param>平滑的最大背离值
/// <param name="contourLineClass"></param>等值线矢量要素集
/// <param name="pGeoDataset"></param>地理要素集
public static void CreateRasterContour(IRaster raster, double[] contourList, bool smooth, double maxDeviation, out IFeatureClass contourLineClass, out IGeoDataset pGeoDataset)
{
RasterSurfaceOpClass class2 = new RasterSurfaceOpClass();
object missing = System.Type.Missing;
object contoursArray = contourList;
IGeoDataset geoDataset = raster as IGeoDataset;
pGeoDataset = class2.ContourList(geoDataset, ref contoursArray); contourLineClass = pGeoDataset as IFeatureClass;
IFields fields = contourLineClass.Fields;
IField[] fieldArray = new IField[fields.FieldCount];
for (int i = 0; i < fields.FieldCount; i++)
{
fieldArray[i] = fields.get_Field(i);
}
if (smooth)
{
IFeatureCursor o = contourLineClass.Search(null, false);
if (o != null)
{
IFeature feature = o.NextFeature();
for (int j = 0; feature != null; j++)
{
IPolyline shape = feature.Shape as IPolyline;
shape.Smooth(maxDeviation);
feature.Shape = shape;
feature.Store();
feature = o.NextFeature();
}
System .Runtime .InteropServices . Marshal.ReleaseComObject(o);
}
else
{
System .Windows .Forms . MessageBox.Show("生成的等值线条数为0"); }
}
}
/// <summary>
/// 创建坡度集
/// </summary>
/// <param name="raster"></param>栅格数据
/// <param name="zFactor"></param>拉伸系数
/// <param name="type"></param>记
录类型{度,百分比}
/// <param name="pGeoDataset"></param>坡度集