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

Yann Voté ygversil at lilo.org
Thu Dec 5 04:43:13 PST 2019


Thank you all for your answers.

Alessandro: the resources folder contains only read-only data (reference 
rasters or vectors from French national geographic institute, not to be 
modified). I deploy these layers on every workstation. Is it still a bad 
practice for read-only reference data to use this folder ?

Raymond: indeed I'm currently working on a plugin, and I've seen 
QgsPathResolver. But documentation for this class is quite terse. but 
I'll continue to investigate and experiment.

Jorge: interesting setup. Does the offline editing plugin work when 
everything is in database ? In other words, are raster layers converted 
offline ?

Cheers.

Yann

Le 05/12/2019 à 13:16, Jorge Gustavo Rocha a écrit :
> Hi,
> 
> In my setup - using PGSERVICES - all vector, raster, styles and projects 
> are stored on database. This is my preferred way to organize the data: 
> on a database. QGIS Server also takes advantage of this setup and 
> publish the projects directly from the database, using the rasters (in 
> db or out of db rasters).
> 
> The few things I'm not sharing on the database are SVG, layout images 
> and fonts.
> 
> There are problems with Postgresql/GDAL access to Postgresql, but if 
> using PGSERVICES it works.
> 
> Best regards,
> 
> Jorge
> 
> On 05/12/19 11: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
> -- 
> Email Signature
> Logo <https://www.geomaster.pt> 	
> *Geomaster*
> *Jorge Gustavo Rocha* | Software Engineer
> *e:*jgr at geomaster.pt | *m:*+351 910 333 888
> *g:*41.54094,-8.40490 | *v: *510 906 109
> *a: * Rua António Cândido Pinto, 67, 4715-400 Braga
> 
> 
> _______________________________________________
> 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