用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"> ...
随机推荐
- asp .net连接打开数据库初步
1 #endregion59 WebDriver
- C# 使用正则表达式去掉字符串中的数字
/// <summary>/// 去掉字符串中的数字/// </summary>/// <param name="key"></param ...
- ServerSocket(TCP/IP协议)__Java
服务器端 //参数为端口号,可以自定义 ServerSocket ss=new ServerSocket(11111); System.out.println("开启监听..." ...
- MySQL索引与Index Condition Pushdown
实际上,这个页面所讲述的是在MariaDB 5.3.3(MySQL是在5.6)开始引入的一种叫做Index Condition Pushdown(以下简称ICP)的查询优化方式.由于本身不是一个层面的 ...
- flex词法解析
例子1.从标准输入的字数.单词.行数统计 %{ #include <string.h> int chars = 0; int lines = 0; int words = 0; %} %% ...
- TFBOY 养成记 一些比较好多文章。
API解释中文版(简书文章,没事看看): http://www.jianshu.com/p/e3a79eac554f Tensorlfow op辨异:tf.add()与tf.nn.bias_add() ...
- HTML基础下
知识点一: HTML5的标准结构: <!DOCTYPE html> <html lang='en'> <head> <meat charset='utf-8' ...
- Mybatis(二)参数(Parameters)传递
Mybatis参数(Parameters)传递 1..单个参数 可以接受基本类型,对象类型,集合类型的值.这种情况MyBatis可直接使用这个参数,不需要经过任何处理. <!-- 根据id查询 ...
- poj1611 解题报告
并查集学习过之后做了几道相关联系,这里贴出1611 The Suspects Time Limit: 1000MS Memory Limit: 20000K Total Submissions: ...
- VC++下编译 程序“减肥”
在vc6 和 vs 2008下 编译 以下代码,不更改任何编译设置(vc6 40k , s2008 7k). 一.vc6下,Release 模式 编译处理. 1.去掉不必要的 链接库 工程(Pro ...