share your qgis project: the relocator plugin

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 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:
changing xml documents and removing paths
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:
relocator plugin
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!
0 0 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

10 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
PatrickStotz
PatrickStotz
5 years ago

Aweome! That was long overdue. Gave it a quick test run on OS 10.10.3 / QGIS 2.8.1 and it works like a charm. Keep up the good work! Cheers

Riccardo
5 years ago
Reply to  PatrickStotz

thanks for testing on MAC!

Riccardo
5 years ago

Thanks to the great community: There are already two packages in the
original repo: Qconsolidate and Qpackage. Try them out as well!

Joris Hintjens
Joris Hintjens
5 years ago

thanks for the work Riccardo, but I use QConsolidate for a long time, with good results. What is the difference with your new plugin?

Riccardo
5 years ago
Reply to  Joris Hintjens

well Qconsolidate doesn’t support zipping a file. Biut you’re right qconsolidate does the same. haven’t seen this plugin prior developing (like written below!)

Riccardo
5 years ago
Reply to  Joris Hintjens

and the relocator plugin supports WMS 😉

Ian Hand
5 years ago

Hi Reccardo, just tested this on a Windows 7 Professional machine, works prefect! Thanks for creating a very useful plugin, will definitely see lots of usage for future projects!

Stefan Simon
Stefan Simon
5 years ago

Hi.

It is an useful plugin… but I have an issue regarding json files.
I tried with a shapefile layer and a geojson layer.
On the save folder, I can see that the json layer is a shape file but the project is not updated.
So.. if you load your saved qgis project, you get “Handle bad layer” for the geoJson layer.

I’m using the plugin in a wrong way?

Thanks,
Stefan

disqusun
disqusun
4 years ago

I installed this after QConsolidate crashed whilst exporting my project files. It worked perfectly, pulling data from both local machine and servers.

I would suggest you add a Success message, where clicking OK closes the plug-in. I ran it in the background, and came back to find it still showed the same thing as when I first clicked OK to run it… Had to check the files manually to be sure anything had happened.

Thanks!

Willem Korevaar
Willem Korevaar
1 year ago

Any change that you make a 3.4 version?