I created a QGIS project containing several layers which are on my PC. I saved the project to my local drive and then I saved it to the network and copied all the relevent project layers into a folder except the osmap shp files which are on a separate network drive.

I then hunted for a way to remap the QGIS project layers so it points to the network copies and not my local drive.

In AutoCAD this is easy, but I can't find a way to do it in QGIS.

I then tried just deleting the layers from the project and then re-adding them from the new location, but I got a minidump crash every time.

I ended up saving the print composers as templates, exporting the layer styles. Then I created a new project, using the files on the network, and created new print composers from the saved templates.

Is there an easier way to make this project available to other users?

I've seen some info about mapping bad layers, but I couldn't find a dialogue box to do that.

If nothing else, everything on the network will eventually end up on the archive drive and we need to be able to keep projects together.

For example, in CAD if I open a project and someone has moved a file into a new folder, it will tell me that it can't find the external reference. I then open the x-refs window, scroll to the saved path, click browse, then find the file in its new folder and click on it. That saves the changed path.

Based on responses so far, I now know that I need to know how to set a path to relative AND how to remap a path to a different folder. One response gives a plugin for the latter, so I will try that. I am close to understanding the former.

The answer seems to be as follows - Save project. Then use the save button again which creates a project home folder. Use Qpackage to copy the shp files to the new destination. Than open that new project and save to create a new project home folder. Then use change data source to remap all the layers to the project home folder (as QGIS does NOT save anything as relative at all. It saves all paths as absolute.)

  • 1
    I was not asking how to archive the project. It is not a duplicate of that other question. If I do what that other question asks about I would end up with duplicated Osmaps clogging up our network drive, one for each project and that would soon use up all our space. It seems that there is actually no way to do what I wanted it to do. Please change the title back to what it was. I wanted a way to set up a project on my local drive. I don't actually want all the data replicated in a new folder. I have edited the question to be clearer. Jan 17 '18 at 10:25
  • I also misunderstood the fact you didn't want to archive all the project. Doing archiving sets the paths to relative, and it solves the problem, but as you point out, it will duplicate all the data each time so it's indeed not a duplicate :)
    – gisnside
    Jan 17 '18 at 10:33
  • 1
    Thanks for the link to the other question though because some projects DO need transferring complete. Qconsolidate doesn't work, but Qpackage does. The OS shp files are copied across to the Q drive. If I can remap my project to point to Q for those and keep the others relative, I'll be sorted. Jan 17 '18 at 10:41
  • Also, to be fair, as I am learning what it can do, I now know more about what I needed to ask which means my question, hopefully, is now clearer. Jan 17 '18 at 10:48

You have a great plugin named "ChangeDataSource", doing just that very easily. The only downside is that you can only do one layer at a time.

Works on any layer type, including database layers, raster, wms, wfs, etc.


Right click on layer tree to change single layer datasource of click on icon to change datasources globally

The plugin allows to change the datasources of the loaded layers. The operation can be performed right clicking on legend items for single layer or globally on a summary table by clicking on toolbar plugin icon. The plugin takes control of bad layers handling allowing to specify valid datasources working on project

See also :



QGIS will like to have all it's data close to its project...

the '.' string means "the folder the .qgs is in. the '..' string means "the folder up from where the project qgs is.

example :

  • if you have a //NETWORK/WORK directory where your qgs is saved (i.e //NETWORK/WORK/myproject.qgs), you can use ./subfolder/mylayer.shp (relative path) to point out to //NETWORK/WORK/subfolder/mylayer.shp (absolute path) which makes your project movable.
  • you can use ../otherfolder/mylayer.shp (relative path) to point out to //NETWORK/otherfolder/mylayer.shp (absolute path).

This way, you'll make your project movable, as long as your data is positionned in the right relative place. You can set this behaviour as default in the project properties (Project Menu).

Relative option

Réf. Saving project with data source path as relative in QGIS?

  • Thanks for the plugin info. I've now installed it and will give it a go, next time. I don't understand the instructions about setting up a relative path. Jan 16 '18 at 17:18
  • Sorry if I wasn't clear enough, i should've been more precise. If you replace the actual path up to the folder by a point in the qgs, qgis will loook for datarelative to the project file location. To make things short : "The path with reference to root directory is called absolute. The path with reference to current directory is called relative." QGIS should be able to use relative paths. But maybe that should eb easier to do : gis.stackexchange.com/questions/20340/…
    – gisnside
    Jan 16 '18 at 20:22
  • I added a picture in my answer
    – gisnside
    Jan 16 '18 at 20:27
  • Thanks but I still not sure that I understand what exactly I have to change. I have that option set to relative, but when I look at the properties of a layer I see the full path listed there. eg - E:/aawork/aasites/aa-all towns and villages/eaton bray/osmap/osmap_polygon.shp The folder osmap is where I have saved the data and the qgis project. How much of the path do I delete to make it relative? Should it be ./osmap/osmap_polygon.shp ? Do I have to do that manually for all the layers? Jan 17 '18 at 10:15
  • Additionally, can I set some layers to be relative and some absolute? Jan 17 '18 at 10:28

you can open the qgs project file in your favorite text editor and do a search/replace with the old/new path.

  • 1
    Watch out if you do this. If for example you do a change involving a drive letter S:/ you could break your https:// links for wms layers (it happened to me). There might be other traps so I suggest to always review the changes. I also had an extra step (I'm on windows) with front- vs back- slashes, I had to do search and replace twice, once with all « / » and once with all « \ ».
    – hagridb
    Jun 28 at 15:00

JGH's answer is a good one for changing a lot of layer location references, but it needs an update for .qgz project files. You cant' just open a .qgz in a text editor because it's a compressed XML file. For .qgz, you have to

  1. Open the .qgz file with Winzip, 7zip, or a similar tool
  2. Open the .qgs file stored inside the .qgz file in your text (or XML) editor
  3. Edit the file system paths, being careful not to break the XML formatting
  4. Save the edited .qgs file back inside the .qgz file

I just did this very thing, and it took me a couple of extra tries to get the two levels of saving (save the XML, save the compressed .qgz that contains it) right. Your file-compressing/uncompressing program will have its own way of doing this, so I don't think I can provide a universal procedure.

Refer to this answer for more on .qgz v .qgs

  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Oct 8 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.