之前在做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. javascript初步了解

    0.1   <script> 和 </script> 会告诉 JavaScript 在何处开始和结束. <script> 和 </script> 之间的 ...

  2. bootstrap navbar items alignment

    https://stackoverflow.com/questions/19733447/bootstrap-navbar-with-left-center-or-right-aligned-item ...

  3. hdu5984

    听说大佬都是看到1.693147就知道是ln(2)+1我是服气的 不过老老实实推的话就看你大一数分/高数是不是学扎实了 令 把L移到右边并两边求导可得,即 令 代入最开始的公式得到 化简可得,得解 # ...

  4. 【LOJ】#2544. 「JXOI2018」游戏

    题解 九条可怜还有那么善良的一面??? 显然有些数在这个区间里没有数是它的约数,它们其中的最后一个取的一定就是\(t(p)\)的值 这样我们只需要枚举\(t(p)\)的值,这个值就是"没有任 ...

  5. Python爬虫笔记(一)

    个人笔记,仅适合个人使用(大部分摘抄自python修行路) 1.爬虫Response的内容 便是所要获取的页面内容,类型可能是HTML,Json(json数据处理链接)字符串,二进制数据(图片或者视频 ...

  6. Scrapy 笔记(三)

    摘抄自Python 一.随机user-agent 的设置 关于配置和代码 这里我找了一个之前写好的爬虫,然后实现随机更换User-Agent,在settings配置文件如下: DOWNLOADER_M ...

  7. php大图

    原文地址:https://laravel-china.org/articles/9450/php-fpm-vs-swoole

  8. CodeForces 805A Fake NP

    直觉. 一段区间中,肯定是$2$的倍数最多,因为区间长度除以$2$得到的数字最大.但只有$1$个数字的时候需要特判. #include <cstdio> #include <cmat ...

  9. JAVA解析xml的四种方式比较

    1)DOM解析 DOM是html和xml的应用程序接口(API),以层次结构(类似于树型)来组织节点和信息片段,映射XML文档的结构,允许获取 和操作文档的任意部分,是W3C的官方标准 [优点] ①允 ...

  10. hdu 1874 畅通工程续(迪杰斯特拉优先队列,floyd,spfa)

    畅通工程续 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Subm ...