Bug report #8589

QGIS not saving relative path correctly

Added by Admire Nyakudya over 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17331

Description

Working with the 1.9 version nightly build when on the project properties I have saved paths to be relative but when I save my project and open it in a text editor It saves the path as absolute.

kaasRelative.qgs (16.1 KB) Richard Duivenvoorde, 2013-09-09 08:10 AM

kaasRelative.qgs (16.1 KB) Richard Duivenvoorde, 2013-09-09 08:24 AM

History

#1 Updated by Giovanni Manghi over 10 years ago

  • Category set to Project Loading/Saving
  • Status changed from Open to Feedback

I cannot confirm, tested on both Linux and Windows with qgis master.

#2 Updated by Richard Duivenvoorde over 10 years ago

I do confirm.

I do have a fresh build release_2_0 here, and I'm not able to save relative paths.

BUT: neither with my fresh build 1.8 version???

You should see relative paths in the .qgs file isn't it? I see this in the qgs file:

<datasource>/home/richard/geodata/world/world.shp</datasource>

#3 Updated by Giovanni Manghi over 10 years ago

fresh .qgis2 folder too?

Richard Duivenvoorde wrote:

I do confirm.

I do have a fresh build release_2_0 here, and I'm not able to save relative paths.

BUT: neither with my fresh build 1.8 version???

You should see relative paths in the .qgs file isn't it? I see this in the qgs file:

<datasource>/home/richard/geodata/world/world.shp</datasource>

#4 Updated by Richard Duivenvoorde over 10 years ago

yes, I removed .qgis2 dir AND .config/QGIS

in properties I set 'relative paths'. In debug I see this:

src/core/qgsprojectproperty.cpp: 321: (dump)     key: <WFSUrl>  value: 
src/core/qgsprojectproperty.cpp: 329: (dump)     key: <Paths>  subkey: <Paths>
src/core/qgsprojectproperty.cpp: 299: (dump)         name: Paths
src/core/qgsprojectproperty.cpp: 321: (dump)             key: <Absolute>  value: false
src/core/qgsprojectproperty.cpp: 321: (dump)     key: <WMSServiceTitle>  value: 

but in .qgs file I see:

<id>provincies20130909170042477</id>                                 
<datasource>/home/richard/geodata/nl/provincies.shp</datasource>     
<title></title>  

.qgis file attached

#5 Updated by Richard Duivenvoorde over 10 years ago

did some further testing, removed also .qgis and .config/QuantumGis dirs

But still absolute paths, if I just open a shp in my home dir, and then save the qgs file in /tmp

BUT if I then copy some data files in /tmp dir, and load those files, THOSE paths are relative in the project file??

Is it possible that QGIS just is not able to 'traverse' all to the right directory or so?

I opened qgis from /home/richard
Open data in /home/richard/geodata/nl
Saved project in /tmp

Then the .qgs file had /home/richard/geodan/nl/data.shp in its xml.
But copying data.shp to /tmp, and (same project) loading the data.shp from /tmp,
the .qgs file had ./data.shp in it's xml (and /home/richard/geodan/nl/data.shp for the other layer which was still in the project)

I wonder if the original issuer can tell us what exact his setup is: Operating System, QGIS version, way of starting and places of data and project saving.

#6 Updated by Matthias Kuhn over 10 years ago

If there in no common ancestor as in your setup (i.e. the only common part of the path is root '/') then there is no reason for saving a relative path and it will be saved absolute.

#7 Updated by Matthias Kuhn over 9 years ago

  • Status changed from Feedback to Closed

Closed due to lack of feedback.
If you are able to provide the feedback required to solve this issue, please reopen it.

Also available in: Atom PDF