• 矢量裁剪栅格(过滤)(c#)


    IClipFilter clipRaster = new ClipFilterClass();

          //Add the polygons from the shapefile to the clip filer
          IGeometry clipGeometry;
          IFeature feature;
          for (int i = 0; i <= featureClass.FeatureCount(null) - 1; i++)
          {
            feature = featureClass.GetFeature(i);
            clipGeometry = (IGeometry)feature.Shape;
            clipRaster.Add(clipGeometry);
          }

          //Set the filter to the raster
          IPixelOperation pixelOp = (IPixelOperation)raster;
          pixelOp.PixelFilter = (IPixelFilter)clipRaster;

          //Now we need to specify properties for the output. The output can
          //be a file format or a geodatabase. This sample supports output
          //to File geodatabase and Personal Geodatabase.
          //If the output is a file format and input raster does not contain NoData and the max value
          //of the pixel depth is being used. (For example 255 is used for
          //8 bit unsigned case), output pixel depth needs to be promoted and NoData
          //value need to set up properly.

          IWorkspace workSpace = openWorkspace(outputFolder);
          IRasterProps rasterProps = (IRasterProps)raster;

          if (workSpace.PathName.Contains(".gdb") == false)
          {
            rasterProps.NoDataValue = 256;
            rasterProps.PixelType = rstPixelType.PT_USHORT;
          }

          //Save the result out
          ISaveAs saveas = (ISaveAs)raster;
          saveas.SaveAs(outputFile, workSpace, Format);
  • 相关阅读:
    树的直径教学思路
    dfs序3树上差分
    DFS序与欧拉序的区别
    DFS序2
    树的重心教学思路
    loadrunner11并发注册码
    JPA 添加 converter
    银行信贷账户管理任务
    《如何启动黄金圈思维》笔记
    《野蛮进化》笔记
  • 原文地址:https://www.cnblogs.com/zuiyirenjian/p/1897395.html
Copyright © 2020-2023  润新知