• Delphi ArcEngine 将要素类转换输出为 Shape 文件


    在这里感谢 “端木飘零”

    procedure ConvertFeatureClassToShapesFile(pFeatureClass: IFeatureClass; pFilePath, pFileName: string);
    var
      pInDataSet, pOutDataSet: IDataSet;
      pInWorkSpace: IWorkSpace;
      pInFeatureClassName, pOutFeatureClassName: IFeatureClassName;
      pOutWorkspaceFactory: IWorkspaceFactory;
      pOutWorkerspace: IFeatureWorkspace;
      pOutWorkspaceName: IWorkspaceName;
      pOutDataSetName: IDatasetName;
      pFieldChecker: IFieldChecker;
      pEnumFieldError: IEnumFieldError;
      pOutFields: IFields;
      pFeatureDataConvert: IFeatureDataConverter;
      pQueryFilter: IQueryFilter;
      pSpatialFilter: ISpatialFilter;

      pFeature: IFeature;
    begin
      if pFeatureClass = nil then
      begin
        exit;
      end;
      //得到输入
      pInDataSet := pFeatureClass as IDataSet;
      pInWorkSpace := pInDataSet.Workspace;
      pInFeatureClassName := pInDataSet.FullName as IFeatureClassName;

      //定义输出
      pOutWorkspaceFactory := CoShapefileWorkspaceFactory.create as IWorkspaceFactory;
      pOutWorkerspace := pOutWorkspaceFactory.OpenFromFile(pFilePath, 0) as IFeatureWorkspace;
      pOutDataSet := pOutWorkerspace as IDataset;
      pOutWorkspaceName := pOutDataSet.FullName as IWorkspaceName;
      pOutFeatureClassName := coFeatureClassName.Create as IFeatureClassName;

      pOutDataSetName := pOutFeatureClassName as IDatasetName;
      pOutDataSetName.Name := pFileName;
      pOutDataSetName.WorkspaceName := pOutWorkspaceName;

      //检查字段
      pFieldChecker := coFieldChecker.Create as IFieldChecker;
      pFieldChecker.InputWorkspace := pInWorkSpace;
      pFieldChecker.ValidateWorkspace := pOutWorkerspace as IWorkspace;
      pFieldChecker.Validate(pFeatureClass.Fields, pEnumFieldError, pOutFields);

      //要素筛选
      pQueryFilter := coQueryFilter.Create as IQueryFilter;
      pQueryFilter.WhereClause := '';

      //转换输出
      pFeatureDataConvert := coFeatureDataConverter.Create as IFeatureDataConverter;
      pFeatureDataConvert.ConvertFeatureClass(pInFeatureClassName, pQueryFilter, nil, pOutFeatureClassName, nil,   pOutFields, '', 100, 0);
    end;
  • 相关阅读:
    2017.12.13T19_B2_6.4内部类
    2017.12.13T19_B2_6.3内部类
    python--spider模拟登录
    Redis数据库
    python--spider验证码
    python--Selenium(动态渲染页面爬取)
    python--Ajax
    python绘图实例
    python绘图
    Numpy库收尾(20190806)
  • 原文地址:https://www.cnblogs.com/chinacodegear/p/1488241.html
Copyright © 2020-2023  润新知