/// <summary> /// 转换栅格图层坐标系 /// </summary> /// <param name="inFilePath">矢量图层</param> /// <param name="spatialReference">坐标系</param> /// <param name="outFile">输出文件</param> public static void ChangeRasterCoordinateSystem(string inFilePath, ISpatialReference spatialReference, string outFile) { ProjectRaster projectRaster = new ProjectRaster { in_raster = inFilePath, out_coor_system = spatialReference, out_raster = outFile }; GeoprocessorHelper.GpExecute(projectRaster); }
private void button3_Click(object sender, EventArgs e) { ToggleEndlessProgress.Execute(); circularProgress1.IsRunning = true; #region GP工具的使用 //得到参数 IRasterLayer layer = GetRasterLayer((string)comboBox1.SelectedItem); string out_raster = textBox1.Text; //实例化GP工具 Geoprocessor gp = new Geoprocessor(); gp.OverwriteOutput = true; //设置栅格投影转换参数 ProjectRaster PR = new ProjectRaster(); PR.in_raster = layer; PR.out_raster = out_raster; IEnvelope tempRaster = GetRasterLayer((string)comboBox2.SelectedItem).VisibleExtent; PR.out_coor_system = tempRaster.SpatialReference; //执行GP工具 IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(PR, null); #endregion #region 运行完成之后的信息提示窗口 balloonTipFocus.Enabled = true; DevComponents.DotNetBar.Balloon b = new DevComponents.DotNetBar.Balloon(); b.Style = eBallonStyle.Alert; //b.CaptionImage = balloonTipFocus.CaptionImage.Clone() as Image; b.CaptionText = "信息提示"; b.Text = "运行成功!"; b.AlertAnimation = eAlertAnimation.TopToBottom; b.AutoResize(); b.AutoClose = true; b.AutoCloseTimeOut = 4; b.Owner = this; b.Show(button3, false); #endregion }