Bug report #14374

Build Virtual Vector tool: file created fails to load correctly

Added by Armando Forlani over 7 years ago. Updated over 4 years ago.

Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:22356


This is either Build Virtual Vector tool not creating the correct xml or QGIS not interpreting it (the correct xml?) correctly.

I have tested this real world scenario: shape files of identical names.

'\\\\..\\data\\folderA\\osm_roads.shp' contains a small bbox selection of central London OSM roads
'\\\\..\\data\\folderB\\osm_roads.shp' contains a small bbox selection of central London OSM roads

The two shape files do not contains the same osm extent, they are adjacent (almost). They are of the same file name but two distinct tiles (different bbox extents).

├ data
│ ├ folderA
│ │ └ osm_roads.shp
│ ├ folderB
│ │ └ osm_roads.shp

Build virtual vector should create a combination (union?) of the two tiles.

Zip file attached containing files, folder structure and results.

1. Launch 'Build virtual vector'
2. 'Run as Batch process...'
3. Remove parameters row. Only one is needed here
4. Select 'Input datasources' --> 'Select from filesystem'
5. Use the search functionality offered by your OS to select the (only two) osm_roads.shp files from the parent folder (\\\\..\\data\\)
6. Name the virtual vector (\\\\..\\data\
7. Do the same with a different virtual vector file name (\\\\..\\data\
8. Run
9. Open virtual vector
10. 'Select all' from the 'Select vector layers to add...' form and click ok

Step 2 should not be necessary in this context. 'Input datasources' box does not allow for file system selection. 'Run as batch process...' does.
Step 5 this is necessary in a real world scenario: hundred of folders exist.
Step 7 it is necessary as this is a "batch processing" (although in this case it's only a work around, not batch processing as such)
Step 10 As expected the Layer name(s) are the same: osm_road but clearly two different vector layers, the Number of features indicates so (different feature counts)

(0. File extension is missing on the Virtual vector file '\\\\..\\data\
oads and \\\\..\\data\
oads2' it opens anyway, not really an issue, only for correctness)
1. Instead of the two adjacent tiles the same one tile (\\\\..\\data\\folderA\\osm_roads.shp) is displayed twice.

This is odd. The actual resulting virtual vector file '\\\\..\\data\
oads' seems to contain the correct xml declarations:

<SrcDataSource relativeToVRT="0" shared="1">\\\\..\\data\\folderA\\osm_roads.shp</SrcDataSource>
<SrcDataSource relativeToVRT="0" shared="1">\\\\..\\data\\folderB\\osm_roads.shp</SrcDataSource>

The xml seems correct but somewhat QGIS interprets it wrongly.

Tested with QGIS 2.12.0 on win 7 and Ubuntu 14.04

In a hipothetical scenario such as this (which I also tested):

├ data
│ ├ folderA
│ │ └ osm_roads1.shp
│ ├ folderB
│ │ └ osm_roads2.shp

Not only the folders are of different names (as in my real world example above) but also the shape files are of different names.

Build virtual vector --> roads12

The resulting virtual vector:
<SrcDataSource relativeToVRT="0" shared="1">\\\\..\\data\\folderA\\osm_roads1.shp</SrcDataSource>
<SrcDataSource relativeToVRT="0" shared="1">\\\\..\\data\\folderB\\osm_roads2.shp</SrcDataSource>

..it is interpreted correctly by QGIS and the two files display correctly i.e. two adjacent tiles.

data.zip (585 KB) Armando Forlani, 2016-02-25 04:43 AM


#1 Updated by Alexander Bruy over 6 years ago

  • Category set to Processing/QGIS

#2 Updated by Giovanni Manghi over 6 years ago

  • Easy fix? set to No
  • Regression? set to No

#3 Updated by Alexander Bruy over 4 years ago

  • Resolution set to worksforme
  • Status changed from Open to Closed
  • Description updated (diff)

Works fine in master. Please reopen if necessary.

Also available in: Atom PDF