<div dir="ltr"><div><span style="font-family:arial,sans-serif;font-size:13px">Chuiqing,</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>You can create an index through SQL. This is the preferred method even if you stick to the shapefile format for your vector data.</div>
<div><br></div><font face="courier new, monospace">OGRDataSource::ExecuteSQL()</font><div><br></div><div>OGR's Shapefile driver supports these SQL commands among others:</div><div><div><font face="courier new, monospace">CREATE SPATIAL INDEX ON layer_name [DEPTH n]</font></div>
<div><font face="courier new, monospace">DROP SPATIAL INDEX ON layer_name</font></div><div><font face="courier new, monospace">REPACK layer_name</font></div><div><font face="courier new, monospace">RECOMPUTE EXTENT ON layer_name</font></div>
<div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 14, 2014 at 10:56 AM, C. Zeng <span dir="ltr"><<a href="mailto:chqzeng@gmail.com" target="_blank">chqzeng@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Chaitanya,<div><br></div><div>Thank you for your response,</div><div>I know I can do this through GDAL binary, and my question is: how can I integrate this function into my code?</div>
<div><br></div><div>

I have a platform like QGIS, I would like the program itself have the ability to create and load .qix file. For example, when I open the .shp file, I can detect whether there is .qix, if not then create a new qix file;</div>


<div>When the user zoom the map window, it will filter the map content via the qix file to accelerate the searching.</div><div>Does GDAL/OGR has similar functions/classes, something like <span style="color:rgb(128,0,128)">OGRSFDriverRegistrar::Createqix(savepath),</span></div>


<div><span style="color:rgb(128,0,128)">OGRSFDriverRegistrar::Loadqix(path)</span><span style="color:rgb(128,0,128)">,</span>to open and use qix files?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Chuiqing,</div><div><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">

On Thu, Feb 13, 2014 at 11:46 PM, Chaitanya kumar CH <span dir="ltr"><<a href="mailto:chaitanya.ch@gmail.com" target="_blank">chaitanya.ch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr">Chuiqing,<br><div><br></div><div>The OGR Shapefile driver supports spatial indexing through qix files. To explicitly create a spatial index use the Create Index command:</div><div><pre>CREATE SPATIAL INDEX ON tablename [DEPTH N]</pre>


<pre><span style="color:rgb(34,34,34);font-family:arial;white-space:normal">Depth can range from 1 to 12. You can issue the SQL command using ogrinfo.</span><br>
</pre><pre><font face="courier new, monospace"><span style="color:rgb(34,34,34);white-space:normal">ogrinfo -sql '</span>CREATE SPATIAL INDEX ON shapefilename [DEPTH N]<span style="color:rgb(34,34,34);white-space:normal">' path/to/shapefile/directory</span></font></pre>



<pre><font face="arial"><span style="white-space:normal"><a href="http://www.gdal.org/ogr/drv_shapefile.html" target="_blank">http://www.gdal.org/ogr/drv_shapefile.html</a> -> Spatial and Attribute Indexing.<br></span></font></pre>


</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 14, 2014 at 3:12 AM,  <span dir="ltr"><<a href="mailto:chqzeng@gmail.com" target="_blank">chqzeng@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



Hi chaitanya_ch,<br>
I know you are an expert on this, I want to know how can I use GDAL library to implemented qix reading and using in spatial filtering.<br>
I have many large shape files in Gigbyte level, they are very slow when navigating in my app. I want to use *.qix file through GDAL library to accelerate it.<br>
<br>
How can I do that?<br>
Thank  you,<br>
<br>
C. Zeng<br>
<br>
<br>
_____________________________________<br>
Sent from <a href="http://osgeo-org.1560.x6.nabble.com" target="_blank">http://osgeo-org.1560.x6.nabble.com</a><br>
<br><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br><a href="tel:%2B91-9494447584" value="+919494447584" target="_blank">+91-9494447584</a><br>


17.2416N 80.1426E
</font></span></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E
</div>