[gdal-dev] How to exploit the spatial index (*.qix) file for spatial filtering?

Dmitriy Baryshnikov bishop.dev at gmail.com
Fri Feb 14 00:55:27 PST 2014


Hi,

The Shape driver work with qix file internally (speed up spatial 
filters). You can find if qix file exist with cpl function: CPLCheckForFile
Also you can create own QuadTree with: CPLQuadTreeCreate

Best regards,
     Dmitry

14.02.2014 9:39, Chaitanya kumar CH ?????:
> Chuiqing,
>
> You can create an index through SQL. This is the preferred method even 
> if you stick to the shapefile format for your vector data.
>
> OGRDataSource::ExecuteSQL()
>
> OGR's Shapefile driver supports these SQL commands among others:
> CREATE SPATIAL INDEX ON layer_name [DEPTH n]
> DROP SPATIAL INDEX ON layer_name
> REPACK layer_name
> RECOMPUTE EXTENT ON layer_name
>
>
>
> On Fri, Feb 14, 2014 at 10:56 AM, C. Zeng <chqzeng at gmail.com 
> <mailto:chqzeng at gmail.com>> wrote:
>
>     Hi Chaitanya,
>
>     Thank you for your response,
>     I know I can do this through GDAL binary, and my question is: how
>     can I integrate this function into my code?
>
>     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;
>     When the user zoom the map window, it will filter the map content
>     via the qix file to accelerate the searching.
>     Does GDAL/OGR has similar functions/classes, something like
>     OGRSFDriverRegistrar::Createqix(savepath),
>     OGRSFDriverRegistrar::Loadqix(path),to open and use qix files?
>
>
>     Thank you,
>
>     Chuiqing,
>
>
>     On Thu, Feb 13, 2014 at 11:46 PM, Chaitanya kumar CH
>     <chaitanya.ch at gmail.com <mailto:chaitanya.ch at gmail.com>> wrote:
>
>         Chuiqing,
>
>         The OGR Shapefile driver supports spatial indexing through qix
>         files. To explicitly create a spatial index use the Create
>         Index command:
>
>         CREATE SPATIAL INDEX ON tablename [DEPTH N]
>
>         Depth can range from 1 to 12. You can issue the SQL command using ogrinfo.
>
>         ogrinfo -sql 'CREATE SPATIAL INDEX ON shapefilename [DEPTH N]' path/to/shapefile/directory
>
>         http://www.gdal.org/ogr/drv_shapefile.html  -> Spatial and Attribute Indexing.
>
>
>
>         On Fri, Feb 14, 2014 at 3:12 AM, <chqzeng at gmail.com
>         <mailto:chqzeng at gmail.com>> wrote:
>
>             Hi chaitanya_ch,
>             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.
>             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.
>
>             How can I do that?
>             Thank  you,
>
>             C. Zeng
>
>
>             _____________________________________
>             Sent from http://osgeo-org.1560.x6.nabble.com
>
>
>
>
>         -- 
>         Best regards,
>         Chaitanya kumar CH.
>
>         +91-9494447584 <tel:%2B91-9494447584>
>         17.2416N 80.1426E
>
>
>
>
>
> -- 
> Best regards,
> Chaitanya kumar CH.
>
> +91-9494447584
> 17.2416N 80.1426E
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140214/c00615b3/attachment.html>


More information about the gdal-dev mailing list