用IFeatureWorkspaceAnno.CreateAnnotationClass 创建注记图层时报“The application is not licensed to modify or create schema”的错误的解决方案。
用IFeatureWorkspaceAnno.CreateAnnotationClass 的方法创建注记图层的时候报“The application is not licensed to modify or create schema”的错误。
下面是测试代码:
public ESRI.ArcGIS.Geodatabase.IFeatureClass CreateFeatureClass(IFeatureLayer fLyr,double referenceScale, IWorkspace2 workspace,IFeatureDataset featureDataset, String featureClassName,IFields fields,
ESRI.ArcGIS.esriSystem.UID CLSID, ESRI.ArcGIS.esriSystem.UID CLSEXT, System.String strConfigKeyword)
{
if (featureClassName == "") return null; // name was not passed in
ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = null;
IFeatureWorkspaceAnno annoFWorkspace = workspace as IFeatureWorkspaceAnno;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)workspace; // Explicit Cast
if (workspace.get_NameExists(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTFeatureClass, featureClassName))
{
featureClass = featureWorkspace.OpenFeatureClass(featureClassName);
return featureClass;
}
ISymbolCollection2 symbolCol=new SymbolCollectionClass ();
IAnnotateLayerPropertiesCollection annoLPColl=new AnnotateLayerPropertiesCollectionClass ();
InnitAnno(fLyr,ref symbolCol ,ref annoLPColl);
IGraphicsLayerScale glScal=new GraphicsLayerScaleClass ();
glScal .ReferenceScale =referenceScale;
IFeatureClassDescription fcDescription = new AnnotationFeatureClassDescriptionClass();
ESRI.ArcGIS.Geodatabase.IObjectClassDescription objectClassDescription = fcDescription as IObjectClassDescription;
featureClass = annoFWorkspace.CreateAnnotationClass(featureClassName, objectClassDescription.RequiredFields, objectClassDescription.InstanceCLSID, objectClassDescription.ClassExtensionCLSID,
fcDescription.ShapeFieldName, null, featureDataset, fLyr.FeatureClass, annoLPColl, glScal, symbolCol, true);
AlterSpatialReference(featureClass, (fLyr.FeatureClass as IGeoDataset).SpatialReference)
return featureClass;
}
报错原因:
在创建注记图层、对SDE里数据进行编辑时,以及需要在SDE和Personal Geodatabase中创建复杂ArcGIS对象时时候需要ArcGIS Engine Enterprise Geodatabase(以下简称GDB Update)许可,但在一般情况下,我们会用将LicenseControl拖放到主窗体上完成初始化。但当Engine程序需要使用ArcGIS Engine Enterprise Geodatabase(以下简称GDB Update)许可的时候,我们就往往会由于意识不到应该使用该许可,以及无法正确的初始化该许可而陷入麻烦。
解决方案:
第一种:使用LicenseControl控件。将该控件拖放到主窗体之上,勾选适当的许可,并确保程序启动该窗体可加载,就可以完成许可初始化。如下图:
第二种:
使用IAoInitialize.Initialize方法加入适当的参数进行初始化。
C#代码如下:
private static bool CheckLicenses()
{
//绑定权限
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
//初始化权限
IAoInitialize m_AoInitialize =new AoInitializeClass();
//Create a new AoInitialize object
if (m_AoInitialize == null)
{
MessageBox.Show("初始化授权失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//Determine if the product is available
esriLicenseStatus licenseStatus = (esriLicenseStatus)m_AoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);
if (licenseStatus == esriLicenseStatus.esriLicenseAvailable)
{
licenseStatus = (esriLicenseStatus)m_AoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);
if (licenseStatus != esriLicenseStatus.esriLicenseCheckedOut)
{
MessageBox.Show("初始化授权失败,程序退出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
else
{
MessageBox.Show("ArcEngine授权无效,程序退出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
return true;
}
用IFeatureWorkspaceAnno.CreateAnnotationClass 创建注记图层时报“The application is not licensed to modify or create schema”的错误的解决方案。的更多相关文章
- 创建注记图层C# IFeatureWorkspaceAnno
http://blog.csdn.net/mydriverc/article/details/1675613 //IFeatureWorkspaceAnno Example //The ...
- 【ESRI论坛6周年征文】ArcEngine注记(Anno/ Label/Element等)处理专题 -入门篇
原发表于ESRI中国社区,转过来.我的社区帐号:jhlong http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=122097 ----------- ...
- ArcEngine标注和注记
转自原文 ArcEngine标注和注记 标注和注记是ArcEngine中提供的两种使用文字信息标注地图要素的方式.其中标注是作为图层的属性存在的,可以动态创建,注记作为地理要素被存储.需要注意的是Sh ...
- AE指定字段转成注记
转自原文 ae指定字段转成注记 ArcMap中有一个功能是Label Features,就是可以将图层内指定字段值显示以Label形式显示在主窗口上,在Label Features后,用右键点击图层, ...
- 【ArcEngine入门与提高】Element(元素)、Annotation(注记)旋转
因项目需要,需要做一个旋转注记的工具.因为注记这玩意用的比较少,网上资源也很少,所以做起来相当头疼.在经过一番研究之后,终于搞清楚注记的存储原理了,原来是和Element的类似,只不过注记是要把Ele ...
- WebGIS中自定义互联网地图局部注记的一种方案
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1. 前言 实际项目中我们经常会遇到这样一种场景:地图底图可能是互 ...
- ArcGis 创建Annotation注记要素类、添加注记要素 并加载到Activeview AO C#
AO中一般有两种方式存储图面注记元素,一种使用TextElement,它是文档级的元素,编辑后要通过文档(mxd)保存:另一种是使用Annotation要素类,它是一个独立的要素类(featurecl ...
- 创建文本注记TextElement
1.创建一个字体 /// <summary> /// 字体设置 /// </summary> /// <param name="size">Th ...
- 创建线注记LineElement
1.根据2点创建一条线 /// <summary> /// 创建线 /// </summary> /// <param name="pnt1"> ...
随机推荐
- EF错误
The model backing the 'XXXXDBContext' context has changed since the database was created. Either man ...
- Dijkstra算法(Swift版)
原理 我们知道,使用Breadth-first search算法能够找到到达某个目标的最短路径,但这个算法没考虑weight,因此我们再为每个edge添加了权重后,我们就需要使用Dijkstra算法来 ...
- WebService学习总结
因为最近开发的项目需求中涉及到了webservice,正好对这块知识以前学过但是又忘记了,于是想着从新学习下,整理一个笔记,便于后面的复习.于是有了本文,下面开始介绍webservice. 一.简介 ...
- python 实用案例 supervisord管理进程详解
Supervisor是由python语言编写,基于linux操作系统的一款服务器管理工具,用以监控服务器的运行,发现问题能立即自动预警及自动重启等功能.Supervisor类似于monit,monit ...
- MS08_067漏洞学习研究
p197 MS08-067漏洞渗透攻击 按照书上的设置做,exploit得到错误信息: Exploit failed [unreachable]: Rex::ConnectionRefused The ...
- 关于ftp的学习:ftp很多人都会用。但会用,不代表我们真正了解它。
ftp.sftp.ftps,您是否是也跟我一样搞不清楚他们的真正意义.它们之间有关联吗(究竟是何种关联),有区别吗(区别倒地在哪里). 亦或是以为自己知道它们,可我们真的了解并认识它们了吗? 如果您被 ...
- form表单提交引发的血案
最近,公司某条产品线上的一个功能出了问题:点击查询的时候,该页面在IE上直接卡死,chrome上会卡顿一段时间候提交表单进行查询.拿到这个bug单子以后,简单重现了下,基本上定位到是查询操作中的问题, ...
- Thinkphp高仿陌陌网页直播
此项目利用 TP+Redis+Nginx+nginx-rtmp-module+ffmpeg+HLS +Swoole 的架构方案 GitHub 地址:https://github.com/DOUBLE- ...
- Linux下编译memecaced
安装memecached的时候要先把依赖的软件全部的安装上! 第一步: 在limux编译memcached需要 :yum install gcc make libtool autoconf 着 ...
- Openssl 生成证书server.key and server.crt
1.key的生成 openssl genrsa -des3 -out server.key 2048 这样是生成rsa私钥,des3算法,openssl格式,2048位强度.server.key是密钥 ...