///
/// 栅格转面
///
/// 栅格路径
///
public static string rasterToPology(string rasterPath)
{
try
{
string pologyPath = System.IO.Path.GetDirectoryName(rasterPath) + "\" + System.IO.Path.GetFileNameWithoutExtension(rasterPath) + "\" + System.IO.Path.GetFileNameWithoutExtension(rasterPath) + ".shp";
if (!Directory.Exists(System.IO.Path.GetDirectoryName(pologyPath)))
Directory.CreateDirectory(System.IO.Path.GetDirectoryName(pologyPath));
//创建gp⼯具
Geoprocessor pGeoprocessor = new Geoprocessor();
pGeoprocessor.OverwriteOutput = true;
RasterToPolygon tRTP = new RasterToPolygon();
tRTP.in_raster = rasterPath;
tRTP.out_polygon_features = pologyPath;
//tRTP.raster_field = "VALUE";
//tRTP.simplify = "SIMPLIFY";
var tGeoResult = (IGeoProcessorResult)pGeoprocessor.Execute(tRTP, null);
if (tGeoResult.Status == ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded)
{
return pologyPath;
}
return null;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
return null;
}
}



