[Qgis-developer] Spatial index - what about having it automatically created and updated ?

kimaidou kimaidou at gmail.com
Thu Feb 27 02:54:56 PST 2014


2014-02-27 11:08 GMT+01:00 Martin Dobias <wonder.sk at gmail.com>:

> Hi
>
> On Thu, Feb 27, 2014 at 4:47 PM, kimaidou <kimaidou at gmail.com> wrote:
> > Hi list,
> >
> > I have some concerns about spatial indexes in QGIS. Spatial indexes are
> very
> > usefull, and for me rather mandatory as soon as you deal with more than
> 100
> > features.
> >
> >
> > I would like to share some ideas about them :
> >
> > 1) Extend QGIS so that it can create spatial indexes for more vector
> format.
> > If I am correct, for now only Shapefiles and Database vector layers can
> have
> > a spatial index created by QGIS . Why not for GeoJson, CSV files, etc ?
>
> The create spatial index functionality is handled by data provider -
> in this case GDAL/OGR - at some point it was available only for
> shapefiles, not sure if anything changed since then.
>


Ah, ok, so I should better ask in GDAL lists !



>
>
> > 2) If possible, create a spatial index for each vector layer added to the
> > canvas if no one is already present. Since it is a quite fast operation,
> the
> > small time needed is worth it.
>
> I am not sure this is the right thing to do it automatically. It could
> however suggest it for large layers for better performance.
>


It could be an option, but I did not think it is worth it as the spatial
index is fast to create. I agree we could detect if the layer is large and
do it only in this case.



>
>
> > 3) If possible, update the spatial index (replace the old qix by a new
> one)
> > every time the vector layer is updated. No need to do so for database
> > layers, but this can be very usefull for big shapefiles. I have seen some
> > people creating a spatial index, then as time passes, they add more and
> more
> > data into the shapefile but forget to update the spatial index. Sometimes
> > this can lead to some data not displayed in QGIS because QGIs seems to
> rely
> > on the outdatedSpatial index.
>
> Doesn't OGR handle the update of the spatial index automatically?
>


I do not know, I should do some more research...  This would be great
indeed.



>
> Regards
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140227/3856e113/attachment.html>


More information about the Qgis-developer mailing list