How to update a Postgresql / PostGIS database with LibreOffice

Even  if it can look weird (use a GIS tool not to update a GIS base) there are occasions when it proves very useful.

A GIS base comprises two types of information : spatial information ( geometry ) and attributes information . For many field projects there is untrained GIS staff responsible for maintaining the information , especially attributes , of a GIS database.

It is easier to provide them with a tool such as LibreOffice rather than training them in GIS. In this article we will discuss the  remote update of a database Postgresql / Postgis. It is obvious that the updates will only concern the data attributes , the creation of geometries remaining reserved for the use of a GIS client.

We will use as Postgres client, LibreOffice Base, the equivalent of Microsoft Access. LibreOffice Base allows the creation of forms , used as updated interface with a database.

To download LibreOffice, follow this link .

For more information regarding forms  creation with LibreOffice, here a link to the corresponding documentation .

You will find abundant documentation and tutorials on how to use forms with LibreOffice. By cons it is not easy to find how to connect to a Postgresql database with LibreOffice. It is this point what we will discuss here . You must start with LibreOffice Base   

The first time you want to connect to your postgresql database, choose Connect a database existing and select PostgreSQL. Next time you can use the option Open a Database file existing . The Connection settings window is displayed .

It is here that, usually, you find the first problem since there is no clear documentation on the structure of the URL to enter . Moreover, this is not a URL it’s actually a chain Connection:
dbname = name of your database hostaddr = IP address of the base port = 5432 user = postgres password = password postgres dbname must correspond exactly the name of your database appears in the window pgAdminIII   

hostadrr is the IP address of the server Postresql . If you are in local, localhost corresponds, in general, to the address 127.0.0.1.

Harbor is the Postgresql listening port . It appears next to the server name. If you keep the default configuration it is 5432.

The user and password have to match a user defined in the Postgresql database. If you want to sign in administrator, it is postgres and the password that you have defined when installing Postgresql. The user setting window appears :

Enjoy to test the connection and check, as well as, the connection string entered in the window former works correctly .

Save the connection file , as well you can you save all these operations in future connections: you will select in the first window Opening a database file existing and you point to this file . You are now connected to the Postgres database.

You can navigate in different diagrams , tables and views of your base.

On the left window you have the Query and Forms buttons that you will let you create them. Just an advice to finish . When you create a form , the first window allows you  to choose the fields to integrate in the form .  

Avoid selecting the geom field. Adding it to the form does not make sense and the user may, inadvertently, make its content unusable .  

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *