[Qgis-user] QGIS Actions and relative path

Asmus Harder asmus.mail at gmx.de
Wed May 18 08:04:56 PDT 2011


When I use relative paths, for spatial files or for a actions, it don't work when I open the QGis project in Quantum GIS. It only works, when I start the project with a double click on the project file (.qgs). 
But then it's no problem to use relative paths with a action.
I'm using QGis 1.6 and Windows XP. 

I save the project, open it with a editor, change the absolute paths into relative, and if i then start the project with double click it works.

Asmus


-------- Original-Nachricht --------
> Datum: Wed, 18 May 2011 14:28:46 +0200
> Von: Andreas Neumann <a.neumann at carto.net>
> An: qgis-user at lists.osgeo.org
> Betreff: Re: [Qgis-user] QGIS Actions and relative path

>  You could probably do this with python. I am not entirely sure if it 
>  works, but there are python actions. The python action gets a reference 
>  to the feature - maybe - if you can access the project file from python, 
>  there is a QgsProject::readPath 
> 
> (http://doc.qgis.org/head/classQgsProject.html#cfdc9943dcba296540309f89e93a9f60). 
>  This way you can detect the absolute path of the project file and build 
>  your path as you like.
> 
>  But you are right, it would be convenient if file reference could be 
>  stored relative to the project file.
> 
>  Maybe Jürgen has some idea.
> 
>  Andreas
> 
>  On Wed, 18 May 2011 04:55:44 -0700 (PDT), iomeneandrei wrote:
> > Dear all,
> > I'm using QGIS 1.6 for windows and I'm using a simple General Action:
> > cmd /c  %MyField
> >
> > I'm using it to open some pdf files. In MyField field I have the 
> > absolute
> > path of my files. Is there a way to use a path relative to the QGIS 
> > project?
> >
> > It would be fantastic to use (in example) this kind of QGIS project
> > structure:
> > - /root of the project
> > -- /raster spatial file
> > -- /vector spatial file
> > -- /file called from actions
> > - ProjectFile.qgis
> >
> > I know that QGIS can use relative path for spatial files, but I do 
> > not know
> > if it's possible to use relative path within actions.
> >
> > Is there a variable that maps the absolute path of the project file? 
> > If it
> > does exist I could write my Action in this way:
> > cmd /c  $PathOfProjectFile %MyFieldWithRelativePath
> >
> > Thank you,
> >
> > a
> >
> > -----
> > Andrea Borruso
> >
> > ----------------------------------------------------
> > email: aborruso at tin.it
> > website: http://blog.spaziogis.it
> > my 2.0 life: http://aborruso.spaziogis.it
> > feed: http://feeds2.feedburner.com/Tanto
> > 38° 7' 48" N, 13° 21' 9" E
> > ----------------------------------------------------
> > --
> > View this message in context:
> > 
> >
> http://osgeo-org.1803224.n2.nabble.com/QGIS-Actions-and-relative-path-tp6377487p6377487.html
> > Sent from the qgis-user mailing list archive at Nabble.com.
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-user
> 
> -- 
>  --
>  Andreas Neumann
>  Böschacherstrasse 10A
>  8624 Grüt (Gossau ZH)
>  Switzerland
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone



More information about the Qgis-user mailing list