/// <summary> /// 配准 后面两个参数是保存的文件和类型 /// </summary> /// <param name="pFromPoint"></param> /// <param name="pTPoint"></param> /// <param name="pRasterLayer"></param> /// <param name="pSaveFile"></param> /// <param name="pType"></param> public bool GeoReferencing(IPointCollection pFromPoint, IPointCollection pTPoint, IRasterLayer pRasterLayer, ISpatialReference pSr, string pSaveFile, string pType) { IGeoReference pGeoreference; pGeoreference = (IGeoReference)pRasterLayer; IRaster pRaster = pRasterLayer.Raster; //判断是否可以配准 if (pGeoreference.CanGeoRef == true) { IRasterGeometryProc pRasterGProc = new RasterGeometryProcClass(); pRasterGProc.Warp(pFromPoint, pTPoint, esriGeoTransTypeEnum.esriGeoTransPolyOrder2, pRaster); pRasterGProc.Register(pRaster); IRasterProps pRasterPro = pRaster as IRasterProps; pRasterPro.SpatialReference = pSr;//定义投影 if (File.Exists(pSaveFile)) { File.Delete(pSaveFile); } pRasterGProc.Rectify(pSaveFile, pType, pRaster);//路径和格式(String) return(true); } else { return(false); } }
/// <summary> /// 地理配准 /// </summary> /// <param name="pFromPoint">采集点集</param> /// <param name="pTPoint">输入点集</param> /// <param name="pRaster">栅格图层</param> /// <param name="pSr">参考坐标系</param> /// <param name="pSaveFile">输出路径</param> /// <param name="pType">格式</param> /// <returns></returns> public bool GeoReferencing(IPointCollection pFromPoint, IPointCollection pTPoint, IRaster pRaster, ISpatialReference pSr, string pSaveFile, string pType) { try { IRasterGeometryProc pRasterGProc = new RasterGeometryProcClass(); pRasterGProc.Warp(pFromPoint, pTPoint, esriGeoTransTypeEnum.esriGeoTransPolyOrder1, pRaster); pRasterGProc.Register(pRaster); IRasterProps pRasterPro = pRaster as IRasterProps; pRasterPro.SpatialReference = pSr;//定义投影 if (File.Exists(pSaveFile)) { File.Delete(pSaveFile); } pRasterGProc.Rectify(pSaveFile, pType, pRaster);//路径和格式(String) } catch (System.Exception ex) { return(false); } return(true); }
/// <summary> /// 配准 后面两个参数是保存的文件和类型 /// </summary> /// <param name="pFromPoint"></param> /// <param name="pTPoint"></param> /// <param name="pRasterLayer"></param> /// <param name="pSaveFile"></param> /// <param name="pType"></param> public bool GeoReferencing(IPointCollection pFromPoint, IPointCollection pTPoint, IRasterLayer pRasterLayer, ISpatialReference pSr, string pSaveFile, string pType) { IGeoReference pGeoreference; pGeoreference = (IGeoReference)pRasterLayer; IRaster pRaster = pRasterLayer.Raster; //判断是否可以配准 if (pGeoreference.CanGeoRef == true) { IRasterGeometryProc pRasterGProc = new RasterGeometryProcClass(); pRasterGProc.Warp(pFromPoint, pTPoint, esriGeoTransTypeEnum.esriGeoTransPolyOrder2, pRaster); pRasterGProc.Register(pRaster); IRasterProps pRasterPro = pRaster as IRasterProps; pRasterPro.SpatialReference = pSr;//定义投影 if (File.Exists(pSaveFile)) { File.Delete(pSaveFile); } pRasterGProc.Rectify(pSaveFile, pType, pRaster);//路径和格式(String) return true; } else { return false; } }