[GIS] Remapping layers in QGIS project to other folders

file pathminidumpqgis

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.)

Best Answer

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.

ChangeDataSource

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 :

screenshots

ADDITIONAL INFO ON RELATIVE AND ABSOLUTE PATHS

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?

Related Question