9. May 2015
The relocator pluginThe first steps I designed was to copy raster as well as vector data to a single defined directory. This is straight forward and uses the
QgsVectorFileWriter.writeAsVectorFormat(layer,path,encoding,crs,type)for vector files distributed over your hard drive(s) and the
shutil.copyfile(src_path, dst_path)for raster files. The only problem was to change a xml document. Yes, a qgs file is a simple xml document and so I used this nice little how-to from the python documentation:
for rank in root.iter('rank'): new_rank = int(rank.text) + 1 rank.text = str(new_rank) rank.set('updated', 'yes') tree.write('output.xml')First I copy the old qgs file to the defined directory and then I adjust all the given source paths to the layers: You will find all your data in the chosen directory along with your qgs file. Furthermore you have the possibility to store this directory in a zip file so it is easy to send the whole set by email or store it on a ftp server. Sharing was never easier:
The plugin can be downloaded and developed via github. It is already pushed to the official plugin repo by qgis but is still flagged as experimental: Can someone check it on a Windows or Mac? Thank you for any comments and/or issues on github!