示例#1
0
 /// <summary>
 /// 新建一个RasterWriter
 /// </summary>
 /// <param name="workSpace">文件位置</param>
 /// <param name="fileName">文件名称(不带有tif的后缀名)</param>
 /// <param name="rasterInfo">要写的栅格的相关信息</param>
 public RasterWriter(string workSpace, string fileName, RasterInformation rasterInfo)
 {
     _workSpace = workSpace;
     _fileName = fileName;
     RasterInfo = rasterInfo;
 }
示例#2
0
 /// <summary>
 /// 获取该栅格图像的相关数据
 /// <remarks>
 /// <list type="bullet">
 /// <item>
 /// <term>
 /// 初始化_pDataset
 /// </term>
 /// <item>
 /// 获取栅格的Height和Width
 /// </item>
 /// </item>
 /// </list>
 /// </remarks>
 /// </summary>
 /// <returns></returns>
 private void Open()
 {
     //Open
     IWorkspaceFactory pRFactory = new RasterWorkspaceFactoryClass();
     IRasterWorkspace2 rasterWorkspace = pRFactory.OpenFromFile(_rasterWorkSapce, 0) as IRasterWorkspace2;
     if (rasterWorkspace == null)
         throw new ArgumentException("栅格文件无法打开");
     _pDataset= rasterWorkspace.OpenRasterDataset(_rasterName);
     //set height and width
     
     IRasterProps pRasterProps = (IRasterProps)GetRaster();
     RasterInfo = new RasterInformation()
     {
         Width = pRasterProps.Width,
         Height = pRasterProps.Height,
         XCellSize = pRasterProps.MeanCellSize().X,
         YCellSize = pRasterProps.MeanCellSize().Y,
         OriginPoint = new PointClass() { X = pRasterProps.Extent.XMin,  Y = pRasterProps.Extent.YMin },
         SpatialReference = ((IGeoDataset) _pDataset).SpatialReference
     };
    
 }
 private void Init()
 {
     var firstCity = Cities.First(item => item.IsSelected);
     RasterReader reader = new RasterReader(HighTrainNoFolderPath, firstCity.Name + "_高铁未通车" + ".tif");
     Info = reader.RasterInfo;
     RasterOp = new RasterOp(reader);   
     RasterOp.Reset();
 }