[QGIS-trac] Re: [Quantum GIS] #1295: spatial index fails

Quantum GIS qgis at qgis.org
Wed Sep 17 22:34:03 EDT 2008


#1295: spatial index fails
-----------------------------------------------------+----------------------
        Reporter:  gespiel                           |         Owner:  nobody       
            Type:  bug                               |        Status:  reopened     
        Priority:  major: does not work as expected  |     Milestone:  Version 1.0.0
       Component:  Vectors                           |       Version:  HEAD         
      Resolution:                                    |      Keywords:               
Platform_version:  XP sp2                            |      Platform:  Windows      
        Must_fix:  Yes                               |   Status_info:  0            
-----------------------------------------------------+----------------------
Changes (by smizuno):

  * status:  closed => reopened
  * resolution:  worksforme =>

Comment:

 This is a Windows problem, specifically the \ (backslash) path separator.

 I tried changing the path separators to forward slashes for a layer file
 in a project file and then tried to create a spatial index on the layer.
 This works.

 In QgsOgrProvider::createSpatialIndex(), line 723 where the filename is
 extracted using dataSourceUri().section(), the separator parameter is '/'.
 If it is changed to '\\' then create spatial index works on Windows. Of
 course, it now won't work for Linux.

 What happens is the SQL statement passed to OGR has something like
 {{{C:\gis\somefile}}} for the layer name instead of {{{somefile}}}

 I believe it is not a good idea to just have the separator be a backslash
 for Windows (and forward slash for other OS) since Windows will accept
 forward slashes as well. Perhaps a test for which kind of separator was
 used should be done first. Then the resulting character is used in
 dataSourceUri().section(). Or there may be a Qt function to change the
 separators?

 There is also a problem with the file name if it contains spaces or
 possibly other special characters as the name is not quoted in the SQL
 string. I assume that someone will use these characters, so this should be
 fixed.

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1295#comment:3>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list