Bug report #14374

Updated by Alexander Bruy about 5 years ago

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.



sequence:

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\

oads)

7. Do the same with a different virtual vector file name (\\\\..\\data\

oads_)

8. Run

9. Open virtual vector

10. 'Select all' from the 'Select vector layers to add...' form and click ok



Notes:

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)



Issues:

(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



Notes:

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.

Back