<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Rebuild Spatial Index on File Geo-Database in File Geodatabase API Questions</title>
    <link>https://community.esri.com/t5/file-geodatabase-api-questions/rebuild-spatial-index-on-file-geo-database/m-p/418604#M701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible using the API to re-build the spatial index for a layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have an application that runs on Citrix servers. Sometimes they get disconnected and the application is forced to close on the server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in records not being updated in the spatial index. As a result any bounding box queries fail to return the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcCatalog I can delete the index then re-add it and then everything is back to normal. I'd like to be able to do that using the API.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Sep 2014 21:44:12 GMT</pubDate>
    <dc:creator>PaulAustin</dc:creator>
    <dc:date>2014-09-10T21:44:12Z</dc:date>
    <item>
      <title>Rebuild Spatial Index on File Geo-Database</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/rebuild-spatial-index-on-file-geo-database/m-p/418604#M701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible using the API to re-build the spatial index for a layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have an application that runs on Citrix servers. Sometimes they get disconnected and the application is forced to close on the server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This results in records not being updated in the spatial index. As a result any bounding box queries fail to return the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcCatalog I can delete the index then re-add it and then everything is back to normal. I'd like to be able to do that using the API.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Sep 2014 21:44:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/rebuild-spatial-index-on-file-geo-database/m-p/418604#M701</guid>
      <dc:creator>PaulAustin</dc:creator>
      <dc:date>2014-09-10T21:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Rebuild Spatial Index on File Geo-Database</title>
      <link>https://community.esri.com/t5/file-geodatabase-api-questions/rebuild-spatial-index-on-file-geo-database/m-p/418605#M702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Switching into load only mode and back will rebuild the index.&lt;/P&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; // Open the geodatabase.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; fgdbError hr;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; wstring&amp;nbsp;&amp;nbsp; errorText;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; Geodatabase geodatabase;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if ((hr = OpenGeodatabase(L"C:/FileGDB_API_Test/OpenTable - Copy/TemplateData.gdb", geodatabase)) != S_OK)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; "An error occurred while opening the geodatabase." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorInfo::GetErrorDescription(hr, errorText);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; errorText &amp;lt;&amp;lt; "(" &amp;lt;&amp;lt; hr &amp;lt;&amp;lt; ")." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -1;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; wcout &amp;lt;&amp;lt; '\n' &amp;lt;&amp;lt; "Open TemplateData.gdb" &amp;lt;&amp;lt; '\n' &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; // Open the counties table.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; Table table;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if ((hr = geodatabase.OpenTable(L"\\counties", table)) != S_OK)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; "An error occurred while opening the table." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorInfo::GetErrorDescription(hr, errorText);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; errorText &amp;lt;&amp;lt; "(" &amp;lt;&amp;lt; hr &amp;lt;&amp;lt; ")." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -1;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; // Switch in and out of LoadOnlyMode. This rebuilds the spatial index&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; table.LoadOnlyMode(true);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; table.LoadOnlyMode(false);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; // Close the table&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if ((hr = geodatabase.CloseTable(table)) != S_OK)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; "An error occurred while closing ManyFieldTypes." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorInfo::GetErrorDescription(hr, errorText);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; errorText &amp;lt;&amp;lt; "(" &amp;lt;&amp;lt; hr &amp;lt;&amp;lt; ")." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -1;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; // Close the geodatabase&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; if ((hr = CloseGeodatabase(geodatabase)) != S_OK)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; {&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; "An error occurred while closing the geodatabase." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorInfo::GetErrorDescription(hr, errorText);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; errorText &amp;lt;&amp;lt; "(" &amp;lt;&amp;lt; hr &amp;lt;&amp;lt; ")." &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return -1;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; }&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Lance Shipman&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Esri&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Geodatabase Product Engineer, File Geodatabase, SQLite&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 15:45:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/file-geodatabase-api-questions/rebuild-spatial-index-on-file-geo-database/m-p/418605#M702</guid>
      <dc:creator>LanceShipman</dc:creator>
      <dc:date>2014-09-15T15:45:53Z</dc:date>
    </item>
  </channel>
</rss>

