[Qgis-user] Handle local layers in resources folder when project saved in PostgreSQL

Raymond Nijssen r.nijssen at terglobo.nl
Thu Dec 5 03:45:44 PST 2019


Not sure if it is a good idea, but you might find a workaround using a 
startup script or plugin containing this functionality:

https://qgis.org/pyqgis/master_temp/core/QgsPathResolver.html

I guess it will be too tricky/hacky but I hope it helps you.

Raymond


On 05-12-2019 12:18, Alessandro Pasotti wrote:
> 
> 
> On Thu, Dec 5, 2019 at 11:58 AM Yann Voté <ygversil at lilo.org 
> <mailto:ygversil at lilo.org>> wrote:
> 
>     Hi all,
> 
>     I can't find a solution to the following issue, or a way to work around
>     it: I have created a project with some PostgreSQL layers to edit and
>     some raster layers on local filesystem. I work on a Linux computer and
>     have put the local layers into the pkg data path resources folder
>     (/usr/share/qgis/resources/local/raster.gpkg).
> 
> 
> Sorry but this is not a good idea, that path is usually not 
> user-writeable and should not be used to store any user related information.
> 
> But if I understand correctly what you were trying to do I'm afraid 
> there is not a solution: the concept of "relative path" means relative 
> to the project's storage path but that path does not make any sense in 
> case of a POSTGRES storage (because POSTGRES is not a local 
> filesystem-based DB in the same sense as GPKG or SPATIALITE are), so 
> your file-system based asset paths are not (and cannot be) converted to 
> relative paths because there is no project path we can relate to.
> 
> This makes portability an issue if the project has filesystem-based 
> layers (rasters in your case).
> 
> There is no solution I'm aware of, storing rasters into PG is also not a 
> viable option at the moment because support is currently buggy (see: 
> https://github.com/qgis/QGIS/issues/30392).
> 
> Cheers
> 
>     I have also saved the project into PostgreSQL so that it can be shared
>     easily. Other users work on Windows computers and have the same rasters
>     under pkg data path resources folder
>     (C:/PROGRAM~1/QGIS3~1.8/apps/qgis/resources/local/raster.gpkg). But
>     when
>     they open the project, Postgis layers are loaded fine, but QGIS says
>     that raster.gpkg cannot be found under the /usr/share/... path.
> 
>     I would expect that layers in the pkg data path resources folder are
>     saved with the inbuilt: prefix, but in fact they are not. Moreover, it
>     seems that one cannot select "Relative" for saving layer paths, in
>     project properties, when project is saved to PostgreSQL. Looks sensible
>     (what is the relative path to a PostgreSQL table ?), but then what
>     can I
>     do to share a PostgreSQL project with local layers ?
> 
>     We all use QGIS 3.8.3.
> 
>     Thank you for any advice !
> 
>     Cheers
> 
>     Yann
>     _______________________________________________
>     Qgis-user mailing list
>     Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
>     List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>     Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 
> 
> 
> -- 
> Alessandro Pasotti
> w3: www.itopen.it <http://www.itopen.it>
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 


More information about the Qgis-user mailing list