Since I developed qgis2leaf together with some great supporters we always struggled with sharing a qgis project: we use different layers, different visualizations and so on. It’s not easy to make sure you’re talking about the same. So why not make it possible to export a whole qgs project with one click…The relocator plugin
The first steps I designed was to copy raster as well as vector data to a single defined directory. This is straight forward and uses theQgsVectorFileWriter.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:
changing xml documents and removing paths
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:
The relocator plugin in qgis plugin installer
Can someone check it on a Windows or Mac? Thank you for any comments and/or issues on github!The post share your qgis project: the relocator plugin appeared first on Digital Geography.
The first steps I designed was to copy raster as well as vector data to a single defined directory. This is straight forward and uses theQgsVectorFileWriter.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:
![](http://i0.wp.com/www.digital-geography.com/wp-content/uploads/2015/05/Screenshot-from-2015-05-08-233123.png?resize=300%2C75)
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:
![](http://i2.wp.com/www.digital-geography.com/wp-content/uploads/2015/05/Screenshot-from-2015-05-09-000358.png?resize=300%2C190)
Can someone check it on a Windows or Mac? Thank you for any comments and/or issues on github!The post share your qgis project: the relocator plugin appeared first on Digital Geography.