[Qgis-user] Rasterlite datasource gets always absolute path

Jo doublebyte at lavabit.com
Fri Mar 22 07:16:29 PDT 2013


Hi,
I had exactly the same problem, but unfortunately I cannot manage to 
load the database in my project other than having the absolute path 
hardcoded :-(

This is the part of the original project (qgs)  file, that refers to the 
rasterlite db:

     <projectlayers layercount="1">
         <maplayer minimumScale="0" maximumScale="1e+08" type="raster" 
hasScaleBasedVisibilityFlag="0">
<id>RASTERLITE_tutorials_raster_table_mercator20130322144222187</id>
<datasource>RASTERLITE:/home/joana/git/GISforEAF/data/tutorials_raster.sqlite,table=mercator</datasource>
             <title></title>
             <abstract></abstract>
<layername>RASTERLITE:tutorials_raster,table=mercator</layername>

I tried to replace the absolute path on data source line, for a relative 
path:

<datasource>RASTERLITE:./tutorials_raster.sqlite,table=mercator</datasource>

When I try to open the project, QGIS complains about "handling bad layers"!

I also tried this (since the project file is "sitting" on the same 
directory of the database):

<datasource>RASTERLITE:tutorials_raster.sqlite,table=mercator</datasource>

And it comes up with the same error :-( I am a bit stuck here; I thought 
the problem would be the GDAL driver:

http://www.gdal.org/frmt_rasterlite.html

But funny enough, when I use this syntax through GDAL directly, it 
accepts the relative paths; for instance:

gdaladdo -ro RASTERLITE:../tutorials_raster.sqlite,table=mercator 2 4 8 16

works, without a problem.

I would appreciate a lot suggestions of how-to overcome this problem, 
since I need to put a QGIS project in one folder, together with the data 
- without absolute paths!
This is because I need to distribute this folder to other computers, so 
it needs to be self contained and it must not have absolute references 
on it.

Btw, I gave a try to the QConsolidate plugin:

http://hub.qgis.org/projects/qconsolidate

but unfortunately it converts the rasterlite layers into tiff files, 
which is not exactly what I want (I want the project to refer to the 
SQLite database and *not* to physical files on disk!

As I said before, any help would be highly appreciated. Thanks for your 
time!

Joana

P.S.: If I don't find a neat solution for this, I am even considering 
writing a script to update the paths on the project file...






More information about the Qgis-user mailing list