Geo-Databases Storing data sets Geospatial Database Basics Commonly used database terms; Schemas - are a way to organize related data, think of them as file folders in your database to store tables and create rules among the contents within. Tables - are used to store the spatial and nonspatial data within the schema. Tables are synonymous with the feature classes you use in a desktop GIS application. Creating schemas and tables can be done with both pgAdmin and QGIS whereas in SpatiaLite Consultancy and capacity bulding services How to create a spatial databases - SpatiaLite 1. Open QGIS and the exploration panel. If the panel Browse is missing, click View | Panels , and click Browse . In this panel you will find the access to SpatiaLite Consultancy and capacity bulding services How to create a spatial databases - SpatiaLite 2.Create a new database Spatiality by clicking SpatiaLite and selecting Create a database … 3. Select the directory of your choice and name the new database, for example BaseTest. It will appear under the rubric SpatiaLite Consultancy and capacity bulding services How to create a spatial databases - SpatiaLite 4. Connect to your database in DB Manager Make sure the DBManager Plug-in is loaded (Plugins >> Manage and Install Plugins) Open DBManager by selecting Database >> DBManager >> DBManager Right-click on Spatialite/Geopackage and select New Connection Locate and open the Created.sqlite file Expand the Spatialite/Geopackage entry in the tree. You should see the sqlite database: Consultancy and capacity bulding services How to create a spatial databases - SpatiaLite 5. Load shapefile data into the database Consultancy and capacity bulding services GIS data and PostGIS Managing a PostGIS Database with QGIS While you can do a lot of management tasks in pgAdmin, I prefer QGIS for managing PostGIS. You will first need to connect to the database. From the Browser pane, right-click PostGIS and select New Connection. You can also use the PostgreSQL tab in the Data Source Manager. The database connection dialog will appear. First, give the connection a name. The name can be anything you want as long as it helps you distinguish your database later from other connections. You will need to enter your host IP and the database name. The host can be found back in pgAdmin under the database properties or on the AWS console under the RDS’s Connectivity & security details under “Endpoint.” Additional Connection Options There are a few options at the bottom of the connection dialog. The two that are probably most worth mentioning when just getting started are the “Also list tables with no geometry” and “Allow saving/loading QGIS project in the database.” With the first option, you can store nonspatial tables in the database which will enable you to query the tables in the DB Manager. Similarly, the second option will let you store QGIS projects in the database. Keeping the projects in a database will give you access to the project’s metadata Consultancy using the in DB Manager. and SQL capacitywindow bulding services GIS data and PostGIS Adding Schema and Tables to Your Database Now that you have set up the connection, you are ready to begin working with the database. There are two ways that you interact with PostGIS using QGIS, through the Browser pane or the DB Manager available from the Database file menu. The Browser pane has somewhat limited options. Right-clicking will give you the ability to create a new schema or table. Consultancy and capacity bulding services The DB Manager It provides additional functionality beyond that of the Browser pane. First, it gives you the ability to import and export spatial and nonspatial data. The Import Layer/File feature button is available on the DB Manager’s tools. To import a shapefile, click the ellipse next to the input and navigate to the file’s location. Select the .shp file or import from a zipped shapefile. The DB Manager’s Schema menu allows you to create and delete a schema. The Table menu will enable you to create new tables and provides additional functionality. You can edit the tables, such as adding and removing columns. With the table menu, you can create primary key constraints and create indexes, allowing spatial queries to run faster. You can also use the Table menu to move a table to another schema in the database. Note: PostgreSQL prefers that table and column names be lowercase. Keep this in mind when creating or importing data. Also, it is important to make sure that each of your tables has a primary key. Consultancy and capacity bulding services pgAdmin4 Consultancy and capacity bulding services Creating new PostGIS Connection and Adding Schema and Tables to Your Database Consultancy and capacity bulding services DB Manager Consultancy and capacity bulding services The tool in the DB Manager is the SQL Window Consultancy and capacity bulding services References 1. Quick start to spatial databases with QGIS and SpatiaLite 2. pgadmin download 3. PostgreSQL 4. DB Manager Consultancy and capacity bulding services