• 矢量裁剪栅格(过滤)(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);
  • 相关阅读:
    非常精辟的几句话
    关于免杀的实践
    分析PE
    分析 Nanocore
    CTO的窘境
    企业级容器云平台
    POJ 2274
    POJ 1703
    POJ 1182
    DNS协议以及报文格式总结
  • 原文地址:https://www.cnblogs.com/zuiyirenjian/p/1897395.html
Copyright © 2020-2023  润新知