Loading

AE开发常见问题总结

问题: Arcgis10.0 组件初始化失败
解决方法: ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.EngineOrDesktop);该语句需要引用ESRI.ArcGIS.Version类库


问题: 无嵌入互操作类
解决方法: 嵌入互操作类 改为 false
在VS2010中,使用.NETFramework 4.0环境时,ESRI的类库嵌入式互操作属性需要设置为False。


向axMapControl控件中添加shp报错

​ 问题:向axMapControl控件中添加shp时,出现了“The specified path is invalid”这个错误,仔细检查代码并无错误;而从文件添加Layer则可以,但ToolBarControl无显示。
​ 解决方法:添加axLicenseControl 控件


问题:
解决方法:
  //清除数据集前必须先刷新
   activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,mapControl.get_Layer(0),null); mapControl.Map.ClearSelection();       
  activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, mapControl.get_Layer(0), null);


连接SDE空间数据库时出错

SDE认证问题: 使用ArcGIS.KeyGen.exe生成一个epp文件 方法:-->server-->All-->拷贝并保存为*.epp文件。认证时加载该文件即可认证完毕。

实例问题: 必须是这样的:"sde:sqlserver:SHENC-PC\SQLEXPRESS"

可选 pPS.SetProperty("AUTHENTICATION_MODE", "DBMS");

找不到ESRI.ArcGIS.Utility;的引用
  在ArcGIS10环境中找不到ESRI.ArcGIS.Utility、ESRI.ArcGIS.Utility.BaseClasses等引用,ArcGIS9.2之后Utility会逐渐被丢弃的,转而用ADF来代替,把ESRI.ArcGIS.Utility和ESRI.ArcGIS.Utility.BaseClasses改为ESRI.ArcGIS.ADF、ESRI.ArcGIS.ADF.BaseClasses问题解决。

​ 另外,9.2中ADF类的引用为ESRI.ArcGIS.ADF和ESRI.ArcGIS.ADF.Connection.在10.0中改为ESRI.ArcGIS.ADF.Local和ESRI.ArcGIS.ADF.Connection.Local


问题:AxSybologyControl依据ArcGis安装路径,加载自带信息,报“为实例化错误!”
     
解决方法: // Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\ESRI\CoreRuntime", true);
      //将CoreRuntime改为安装目录Desktop10.0
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\ESRI\Desktop10.0", true);


问题:CreateFeatureDataset()失败 报“no License”错误
    featureDataset = featureWorkspace.CreateFeatureDataset(featureDSName, spatialReference);
解决方法:
  直接 在 license Control 中 修改 属性 选中 extention 项 选中:spatial analyst 或
先:
   esriLicenseStatus licenseStatus = esriLicenseStatus.esriLicenseUnavailable;
IAoInitialize m_AoInitialize = new AoInitializeClass();
licenseStatus = m_AoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
licenseStatus = m_AoInitialize.CheckOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst);

问题:在窗口里的层层嵌套SplitContainer后,出现最内层SplitContainer内部TocControl控件图层无法显示问题
解决方法:
加载完mxd后代后加上axTOCControl1.SetBuddyControl(axMapControl1)即可解决。不过若很多地方要加载mxd话,需要每个地方要加。最佳方法是在代码最开始执行的地方加上。


问题:feature.Delete() 时,对 COM 组件的调用返回了错误 HRESULT E_FAIL
解决方法 : 把featureCursor = featureclass.Search(null, true);        //共享内存
      改成featureCursor = featureClass.Search(null, false); //不共享内存

​ //清除图层原有实体对象
​ //featureCursor = featureClass.Search(null, true);
​ featureCursor = featureClass.Search(null, false); //不共享内存
​ IFeature feature;
​ feature = featureCursor.NextFeature();
​ while (feature != null)
​ {
​ feature.Delete();
//featureCursor.DeleteFeature();
​ feature = featureCursor.NextFeature();
​ }


问题:featureBuffer.Shape = geometry;时 报“No support for this geometry type”错误
解决方法:查看FeatureClass中geometry type是否与 geometry中geometry type相同。


9.x中ESRI.ArcGIS.Display.tagRECT在10.x中改为ESRI.ArcGIS.esriSystem.tagRECT


在64位操作系统中需要在项目的编译选项中,将Target CPU选择为x86?


IMap.ClipGeometry在10.x中需要结合IMapClipOptions接口一起使用?


问题:You are not licensed for ArcInfo

  Use the ArcGIS Administrator to view the software availability,change the license manager,or switch the ArcGIS software product.
  

  解决方法:  1、可尝试:解决办法启动ArcGIS License Manager服务()。若没有
         2、使用ArcGIS.KeyGen.exe生成一个License,覆盖service.txt内容,并在 lincense Adiministrator 中 刷新 及 修改。。 为 localhost


未认证问题:the application is not licensed to perform this operation
解决方法:

​ 方法一:看是否将ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);

​ 错写成了:ESRI.ArcGIS.RuntimeManager.BindLincense(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
  方法二:将LicenseControl控件初始化为 第二项:geodatabase


AE中,对 COM 组件的调用返回了错误 HRESULT E_FAIL。

ArcgisEngine二次开发中,进行地理处理,即:相交操作,交集取反操作,擦除操作等过程中,如果权限分配不当,就会出现上面对 COM 组件的调用返回了错误 HRESULT E_FAIL 的错误

​ 原因如下:在进行擦除,交集取反等高级操作时,必须是ArcgisInfo级别的许可授权,否则无法进行操作,而相交操作用ArcgisEngine级别即可。(不稳定,会出错,建议2)

​ 解决如下:1.如何使用licenceControl控件选择ArcgisInfo选项即可,同时选中其中的Spatial Analysis 即可

​ 2.在项目启动main方法中添加一些代码

ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
#region 初始化许可
              IAoInitialize m_AoInitialize = new AoInitializeClass();
esriLicenseStatus licenseStatus = esriLicenseStatus.esriLicenseUnavailable;
licenseStatus = m_AoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
if (licenseStatus == esriLicenseStatus.esriLicenseNotInitialized)
{
    MessageBox.Show("没有esriLicenseProductCodeArcInfo许可!");
    Application.Exit();
}
#endregion

其中的ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);是两个方法都必须的

​ 注意:在进行授权时,必须高权限在前面,否则将不起作用,许可要从高到低添加,由高到低的排序为:esriLicenseProductCodeArcInfo、esriLicenseProductCodeArcEditor、esriLicenseProductCodeArcView、esriLicenseProductCodeArcServer、esriLicenseProductCodeEngineGeoDB、 esriLicenseProductCodeEngine

posted @ 2019-08-08 10:34  F(x)_King  阅读(796)  评论(0编辑  收藏  举报