Create or updte a spatial index in a table is a danger operation .. So in postgis it is availabale only to user with write grant.
QGIS is unable to understand if a connection is readonly or write enable so try to do an automatic update is a trouble-matic operation if a table was open from a read-only user. Another question is why it should be complex for an user to create an index ? A second question is what kind of index ? On postgis is possible to do more than one index. A table could have more than one geometry and every one could have a spatial index or not. But an index is a space consuming and often the index is needed on 1 only geometry field menawhile the other geometry field are only for special uses. To do always automatically a spatial index on every geometry filed is really a not useful operation in these use-case. A. 2014-02-27 15:04 GMT+01:00 Etienne Tourigny <[email protected]>: > > > > On Thu, Feb 27, 2014 at 10:56 AM, Etienne Tourigny < > [email protected]> wrote: > >> That's a python plugin (ftools), so it may not be available to everyone. >> >> Better to do it natively (in the data provider) doing something like >> OGR_DS_ExecuteSQL("CREATE SPATIAL INDEX ON tablename [DEPTH N]") - >> untested >> > > there is already a function QgsOgrProvider::createSpatialIndex() (for > shapefiles only) which is called by QgsOgrProvider::syncToDisc() if the > spatial index already exists. > > >> >> I think it's a great idea to do this automatically with large ogr data >> sources >> >> as you said you should probably ask the gdal-dev list about which drivers >> support spatial index creation an automatic update. >> >> cheers >> Etienne >> >> >> On Thu, Feb 27, 2014 at 7:51 AM, kimaidou <[email protected]> wrote: >> >>> Hi >>> >>> 2014-02-27 11:14 GMT+01:00 Andrea Peri <[email protected]>: >>> >>> I guess more better is to use this extremely simple batch and create all >>>> the index in one step only. >>>> sing the gdal/ogr from osgeo4w. >>>> >>>> http://trac.osgeo.org/gdal/wiki/BatchCreationIndexesForShapefilesOnDOS >>>> >>>> Regards, >>>> >>>> >>> >>> As I said, I am thinking of non power users. They surely won't create >>> nor use such a batch file, even if it is simple. I know there is also the >>> great tool Vector / Data management tools / Create Spatial Index, which can >>> create one for all layers in one step. But users do not use it : they do no >>> know it exists, or they know but forget to use it. >>> >>> >>> _______________________________________________ >>> Qgis-developer mailing list >>> [email protected] >>> http://lists.osgeo.org/mailman/listinfo/qgis-developer >>> >> >> > -- ----------------- Andrea Peri . . . . . . . . . qwerty àèìòù -----------------
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
