之前在做shp数据导入Geodatabase中时,程序运行出现错误提示:“The spatial index grid size is invalid”。

后来查阅esri帮助找到了原因。是LoadOnlyMode的问题。记下来,以后好好研究。

http://support.esri.com/en/knowledgebase/techarticles/detail/35007

Error:  The spatial index grid size is invalid

Article ID: 35007
Software:  ArcGIS - ArcEditor 9.3, 9.3.1, 10 ArcGIS - ArcInfo 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcView 9.2, 9.3, 9.3.1, 10
Platforms: N/A

Error Message

When creating a new feature through either the CreateFeature and Store method or the use of an InsertCursor, the creation fails with the following error:

"FDO_E_INVALID_GRID_SIZE 
-2147216894 
The spatial index grid size is invalid."

Cause

The FDO_E_INVALID_GRID_SIZE error is raised because the grid size of the feature class where the feature is being created is too small to handle the feature. This error only occurs with File or ArcSDE Geodatabases.

Solution or Workaround

Depending on how the error message is being raised, there are two different ways to handle the error.

  1. If this error is encountered while editing within ArcMap, recalculate or modify the grid size of the feature class to accommodate the new feature. The recalculation of the grid size must be done from the Feature Class properties dialog box within ArcCatalog. This requires the use of the Stop Editing function, save any edits, and close the Map Document containing the feature class. For steps on how to recalculate or modify the grid size of a feature class, see the following Web help documentation: Setting spatial indexes.
  2. If this error is being encountered programmatically through the ArcObjects API, notifying the user to manually modify the spatial index is not an ideal solution. Instead, this error can be prevented by placing the feature class into LoadOnly mode prior to inserting the feature. When the feature class is taken out of LoadOnly mode, the Geodatabase automatically recalculates an appropriate grid size. The following code sample demonstrates how to use LoadOnly mode with a feature class: 
    'Place the feature class in loadonly mode. This steps needs to happen prior to calling IFeature.Store or IFeatureCuror.InsertCursor

    Dim pFCLoad As IFeatureClassLoad

    Set pFCLoad = pFeatureClass

    pFCLoad.LoadOnlyMode = True 'Create feature buffer

    Dim pFeatBuffer As IFeatureBuffer

    Set pFeatBuffer = pFeatureClass.CreateFeatureBuffer

    Set pFeatBuffer.Shape = pGeometry 'Create insert cursor and insert buffer

    Dim pCursor As IFeatureCursor

    Set pCursor = pFeatureClass.Insert(True) 'Insert the feature and call flush

    pCursor.InsertFeature pFeatBuffer

    pCursor.Flush 'Take the feature class out of loadonly mode, the Geodatabase will calculcate an appropriate grid size based on the features within the feature class

    pFCLoad.LoadOnlyMode = False

空间索引网格大小无效的解决方法The spatial index grid size is invalid的更多相关文章

  1. 设置height:100%无效的解决方法

    设置height:100%无效的解决方法 刚接触网页排版的新手,常出现这种情况:设置table和div的高height="100%"无效,使用CSS来设置height:" ...

  2. WPF:指定的命名连接在配置中找不到、非计划用于 EntityClient 提供程序或者无效的解决方法

    文/嶽永鹏 WPF 数据绑定中绑定到ENTITY,如果把数据文件做成一个类库,在UI文件中去应用它,可能遇到下面这种情况. 指定的命名连接在配置中找不到.非计划用于 EntityClient 提供程序 ...

  3. 移动端bug~~移动端:active伪类无效的解决方法【移动端 :active样式无效】

    移动端:active伪类无效的解决方法[移动端 :active样式无效]2016-09-26  15:46:50 问题: 移动端开发的时候实现按钮的点击样式变化,但是在iphone[safiri Mo ...

  4. js中style.display=""无效的解决方法

    本文实例讲述了js中style.display=""无效的解决方法.分享给大家供大家参考.具体解决方法如下: 一.问题描述: 在js中我们有时想动态的控制一个div显示或隐藏或更多 ...

  5. redhat linux enterprise 5 输入ifconfig无效的解决方法

    redhat linux enterprise 5 输入ifconfig无效的解决方法   在安装完成linux后,进入终端,输入命令行ifconfig,会提示bash: ifconfig: comm ...

  6. 排错-安装SQl 2008“为SQL Server代理服务提供的凭据无效的解决方法

    安装SQl 2008“为SQL Server代理服务提供的凭据无效的解决方法 by:授客 QQ:1033553122 在Windows Server 2008安装SQL Server 2008出现的问 ...

  7. Node.js中针对中文的查找和替换无效的解决方法

    Node.js中针对中文的查找和替换无效的解决方法.   //tags的值: tag,测试,帖子 var pos1 = tags.indexOf("测"); //这里返回-1 ta ...

  8. QWidget子窗口中setStyleSheet无效,解决方法

    继承 QWidget setStyleSheet无效,解决方法. 发现 继承自QWidget的自定义类 ,使用setStyleSheet无效, 如果删除头文件中的 Q_OBJECT,setStyleS ...

  9. 表格Table宽度设置无效的解决方法

    表格Table宽度设置无效的解决方法 bootstrap中使用table时发现不管用width赋值方式都无法改变table>td的宽度 解决方法: 设置table:table-layout:fi ...

随机推荐

  1. TCP可靠传输和拥塞控制

    1.TCP的可靠传输 tcp的可靠传输主要靠 来自接收方的确认报文 和 超时重传. 发出报文,计时器开始计时,在规定超时时间内未收到确认报文则重新发送. 注意:发送报文都留一个副本,如果收到确认报文就 ...

  2. 791. Custom Sort String

    S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sort ...

  3. centos修改oracle字符集

    1.首先以sysdba的身份登录上去 conn /as sysdba2.关闭数据库shutdown immediate;3.以mount打来数据库,startup mount4.设置session S ...

  4. python快速教程-vamei

    2016年10月26日 12:00:53 今天开始着手python的学习,希望能高效快速的学完! Python基础(上)... 7 实验简介... 7 一.实验说明... 8 1. 环境登录... 8 ...

  5. jquery的一个模板引擎-zt

    jQuery-jTemplate.js下载:http://jtemplates.tpython.com/ 一 , 简单介绍 它是一个基于jQuery开发的javascript模板引擎.它主要的作用如下 ...

  6. Numpy存取文件

    来自 Python科学计算 http://hyry.dip.jp/tech/book/page/scipy/numpy_file.html NumPy提供了多种存取数组内容的文件操作函数.保存数组数据 ...

  7. windows关闭aslr办法

    关闭aslr方便调试分析. 转:https://www.52pojie.cn/thread-377450-1-1.html windows关闭aslr办法 如 @Hmily  前辈所说, Window ...

  8. JAVAEE学习——hibernate04:查询种类、HQL、Criteria、查询优化和练习为客户列表增加查询条件

    一.查询种类 1.oid查询-get 2.对象属性导航查询 3.HQL 4.Criteria 5.原生SQL 二.查询-HQL语法 //学习HQL语法 public class Demo { //基本 ...

  9. AppDomain.CurrentDomain.BaseDirectory是什么

    AppDomain.CurrentDomain.BaseDirectory 是获取基目录,它由程序集冲突解决程序用来探测程序集.由显示的路径可以看出,它代表的是程序集所在的目录,它具有读取和写入的属性 ...

  10. 检验Xcode是否被改动过的简单方法,不妨试试!!!

    检验Xcode是否被改动过的简单方法,不妨试试!!!       在终端系统上运行以下命令启用检测: spctl --assess --verbose /Applications/Xcode.app  ...