ArcEngine入门笔记1

来源:互联网 发布:html5源码下载 编辑:程序博客网 时间:2024/05/13 09:53

ArcGis10.1+VS 2010


1、错误:1)ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIScomponents

2)在调用ARCGIS的组件或者功能时报如下错误:
“检索 COM 类工厂中 CLSID 为 {5374EC4C-1AA2-4829-A811-DE624ECEC23F} 的组件失败,原因是出现以下错误: 80040111 ClassFactory 无法供应请求的类在调用ARCGIS的组件或者功能时报如下错误:

解决:添加引用Esri.ArcGIS.Version,在program.cs中的main()函数中的Application.Run(new Form1());语句前 添加ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);


2、错误:pQueryFilter = new QueryFilterClass();虽然已经引用了using ESRI.ArcGIS.Geodatabase;但报错

解决:在引用ESRI.ArcGIS.Geodatabase的属性embed interop types改为false。


3、以下为转载网上的:

未处理 System.Runtime.InteropServices.COMException
Message="每用户订阅上的所有人 SID 不存在 (异常来自 HRESULT:0x80040207)"
Source="ESRI.ArcGIS.Geodatabase"
ErrorCode=-2147220985

        貌似是升级到v9.3才有的错误,检查发现是QueryFilter.WhereClause语句在查询shapefile格式的图层出现了问题,试验在查询gdb格式的图层不会报错。打开ArcGIS比较了两种格式的属性查询存在以下的区别:

        1.shapefile的字段名用双引号如:"fieldName"而GDB的采用[fieldName]格式;

        2.shapefile的模糊查询用like '%A%' 而GDB用like '*A*' ;

       3.shapefile的非字符字段不支持模糊查询而GDB格式的支持;不过我记得9.2的时候好像支持^_^。

        所以在查询前必须判断一下图层的数据源类型:

            if (pDateset.Workspace.Type == esriWorkspaceType.esriFileSystemWorkspace)
            {
                    pQueryFilter.WhereClause = "\"" + fldName + "\"" + " like '%" + this.txt_findObject.Text.Trim() + "%'";//shpfile
             }
            else
            {
                    pQueryFilter.WhereClause = "[" + fldName + "]" + " like '*" + this.txt_findObject.Text.Trim() + "*'"; //gdb
            }


            


原创粉丝点击