8

I have a qgis file, referring to a few shp files, saved on a google drive folder which is synced across two computers using different OS, one is Mac OS X, the other Windows 8. So, the absolute path of this qgis file on different operating systems is different. But the location of this qgis project file in relation to the shp files it refers to is the same.

E.g: On the Mac OS X computer, the locations of the project file and the shp file are:

/Users/David/GoogleDrive/GIS/Project/project_01.qgs

and

/Users/David/GoogleDrive/GIS/Project/data/road.shp

On the Windows 8 computer, the locations of the project file and the shp file are:

C:\Users\David\GoogleDrive\GIS\Project\project_01.qgs

and

C:\Users\David\GoogleDrive\GIS\Project\data\road.shp

I setup this qgis project file as using relative path, following the suggestion from the following post: relative path

This project works file in Mac OS X, even if I move the qgis file and the associated shp files to different directory.

However, I got a window popping out when opening it Windows 8, saying "Handle bad layers" and asking me to re-specify the locations of all the shp files again.

Isn't the relative path supposed to deal with this kind of situation?

May I ask how to solve this problem related to qgis project file saved in Google Drive folder that is synced across different operation systems?

  • I'm using GoogleDrive/Dropbox to sync between Win and Ubuntu, but cannot confirm this issue. Maybe OSX specific? Does it happen with every project? – underdark Sep 17 '16 at 16:24
  • Dear underdark, thanks! I assume the file structure of Ubuntu and Mac OS X are similar as both a unix systems. So, I wonder how you organize your QGis project file using GoogleDrive. Can you post the file path of your QGis project file in GoogleDrive on both your Win and Ubuntu systems? Thank you! – oat Sep 20 '16 at 8:06
  • 2
    The project file is a simple text file. You can open it with any text editor and compare the folder specification created by Unix and OSX versions of QGIS. – AndreJ Oct 15 '16 at 9:46
6

I looked at the .qgs project file before and after I use the "save as" function.

It seems that the the relative path for a shp file will be changed to an absolute path after the project file is "saved as" a new project file. (see images below)

The relative path of a shp file used in the QGIS project file:

enter image description here

After saving the project as a new file, the absolute path of the shp file is registered in the .qgs file:

enter image description here

Here is the solution:

After saving the current QGIS project file as a new file, you MUST press the SAVE button so as to confirm that the relative path is registered in the project file. Otherwise, the absolute path will be used.

Please pay attention to the folder structure before and after pressing the SAVE button as shown in the images below:

before pressing the SAVE button:

enter image description here

after pressing the SAVE button:

enter image description here

I hope the QGIS team can check this issue and add the function of "automatically register the relative path" for the "save as" function.

  • I suggest to merge your two answers into one. You can still edit the first answer. – AndreJ Oct 17 '16 at 5:48
  • 1
    If you think there is something to be fixed in QGIS, please open a bug report. – Matthias Kuhn Oct 17 '16 at 6:09
  • Dear Matthias, Thanks! I'm requesting a mantra to Create OSGeo Userid to report a bug for QGIS as you suggested. – oat Oct 17 '16 at 6:15

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.