#region//栅格统一赋值
public static void RasterUnified(string elementPath, string outPath)
{
Geoprocessor GP = new Geoprocessor();
GP.OverwriteOutput = true;
RasterCalculator rasterToInt = new RasterCalculator();
//将栅格所有值设置为0
rasterToInt.expression = "Con( ~IsNull(\"" + elementPath + "\"),0)";
rasterToInt.output_raster = outPath;
try
{
GP.Execute(rasterToInt, null);
MessageBox.Show("转换成功!");
}
catch (Exception ex)
{
string str = "";
for (int i = 0; i < GP.MessageCount; i++)
{
str += GP.GetMessage(i);
str += "\n";
}
MessageBox.Show(str);
}
}
#endregion
QQ交流群:607330463 GIS开发技术最强交流群