Open jshirokov-bs opened 1 year ago
@jshirokov-bs : including the error you see here would be helpful
For editing, you need a dataset stored in a postgis DB which is added to your qgis project as a layer. Additionally, you need to set write permissions to the respective data resources in the admin gui - look at the demo edit_points/edit_lines/edit_polygons for an example.
@tpo
As a test example, I simply add the "edit_points" layer from the demo project (directly from postgre) to the new "world13" project , place the .qgs in the "scan" folder and start configuring services. After that, this error occurs.
Are you using a pg service connection in the datasource for edit_points or are you using hostname/port/username/password?
@manisandro
Something like this. I connect to Postgres, load a layer from the database, create a project and put it in "scan". Is that correct?
No, you need to use a service definition (as defined in pg_service.conf), as the necessary connection information differs inside the docker from the host system (i.e. in the container the DB can be found at qwc-postgis:5432
whereas on the host it can be found at localhost:5439
).
So rather than specifying host
/port
/database
/etc, just set service
to qwc_geodb
and add a matching service definition to your host ~/.pg_service.conf
[qwc_geodb]
host=localhost
port=5439
dbname=qwc_demo
user=qwc_service
password=qwc_service
sslmode=disable
@manisandro So, if i get this correct, i need to do this pipeline:
But after that, unfortunately, I can't connect to the database. I think I'm foolishly missing something.
QGIS isn't picking up your service definition. Either you have not restarted QGIS since changing your pg_service.conf, or you have added your service definition to file which is not picked up by the postgres library. The default location for the pg service configuration file for your user is ~/.pg_service.conf
aka /home/$USER/.pg_service.conf
.
(If you specify service, you don't need to specify host/port/database/user/password as they are specified in the service definition.)
@manisandro Is it a file that is located in the qwc-doker directory, or is it some other file with the .conf extension?
The pg_service.conf
located in the qwc-docker
folder is the one which is mounted into the docker containers and contains the service definitions used by the docker containers.
The service definitions for the host system need to be placed in your home directory as I wrote above.
@manisandro But I don 't ~/.pg_service.conf in the directory /home/$USER/. Should I add it manually?
Yes
@manisandro okey, so i create /.pg_service.conf in /home/$USER/. I added this text:
[qwc_geodb]
host=localhost
port=5439
dbname=qwc_demo
user=qwc_service
password=qwc_service
sslmode=disable
After that, I restarted QWC2 and tried to connect through the "Service". Nothing has changed.
In order to test your connection to the local DB start with psql (and not QGIS).
So from the commandline do this:
PGSERVICE=qwc_geodb psql
Only after you are able to connect in this way via psql to your local DB try to connect to it from QGIS.
@tpo I got this result. This doesnt look helpful.
It is helpful :-D - it tells you that your DB and PGSERVICE configuration indeed works!
I am guessing from the screenshots you posted: you are running QGIS on a windows machine? If that is the case then you need to put the pg_service.conf file under C:\Users\<YOUR_USER_NAME_HERE>\AppData\postgresql\.pg_service.conf
Also what is hidden by the "Enter Credentials" window? There are authentication settings that are not visible in the screenshot
@tpo It worked! Now I can connect via the service. The question remains with editable layers. I need to copy a layer from a demo project and place .qgs in "scan", then reconfigure the service, click "import maps" in resources... and then? Or am I incorrectly describing the sequence of actions?
When I try to add an editable layer from demo to the natural-earth-countries project, I get the following message in the log:
but in the project I have a layer
Hello, I'm having the same issue, while trying to load project and its layers from the postgis connections. I manually configures the themesConfig.json to add the project. And when i run the config generator I get the following error.
That error message is most likely accurate. Verify that the credentials you have specified for qgisprojects
in you pg_service.conf
do indeed have read access to qwc_geodb.qgis_projects
.
@jshirokov-bs Were you able to fix your issue?
@RodolfoMontenegro Please open a new issue for your problem.
@RodolfoMontenegro Please open a new issue for your problem.
Thank you @HusseinKabbout , I was able to fix the issue.
Hello.
I can add a new project to QWC2 using WFS. But how can I add an editable layer to a new project? If I add an editable layer from a demo project to my own project from Postgres, an error occurs during configuration.
Hello @jshirokov-bs How have you been able to add a project to QWC2 using WFS?
Hello.
I can add a new project to QWC2 using WFS. But how can I add an editable layer to a new project? If I add an editable layer from a demo project to my own project from Postgres, an error occurs during configuration.