In this section, you will import spatial data into PostGIS database (data you viewed in the previous section). By storing data in enterprise database, multiple users can access and edit it simultaneously.
The first step is connecting to the database using QGIS Desktop.
Enter the connection details:
- Name: you can use any name
- Host: Name/IP of server hosting the database
- Port: PostgreSQL database port
- Database: Database name (geogate_DB created in previous section)
Click on “Test Connection” in order to test the connection
Check “Also list tables with no geometry” in order to access regular tables in database (non-spatial tables)
Double click the new connection you created (test connection) in QGIS Browser to list its tables.
Go to “DB Manager” by from Database toolbar (Database toolbar>DB Manager>DB Manager)
Explore the database from DB Manager, and click on “Import” icon as shown below.
First of all, select the layer you want to import to database (Buildings layer), and identify some parameters that will be used for importing it into the database
- Table: Name of table in the database
- Primary key:For creating primary key field in table in database, and the name of this primary key field
- Geometry column: Name of geometry field (Shape field) that will store geometry details in table
- Source/Target SRID: Well Known ID if the coordinate system of data, in this example data is in Palestine_1923_Grid (28191) coordinate system, for more information please refer to this link
- Encoding: Characters encoding of attribute data
- Create Spatial index: For creating spatial index for the dataset
- Finally, click “OK” to import the layer to database.
Now, repeat the same procedure with the Parcels and Urban Master Plan layers
Remove the layers that you added from the file geodatabase and add the new ones from the PostGIS database (from test connection)