Creating a spatial database
Creating a spatial database in QGIS is a simple task to perform. QGIS comes with two spatial database types that can be easily created without the need to install or set up anything.
SpatialLite and GeoPackages are relational databases that are stored as flat files. What this means is that the data is stored within a single file and not on traditional server-based database applications such as Oracle or Postgres/PostGIS.
We will be dealing with GeoPackages in this chapter, which is an OGC compliant GeoSpatial format. It is open source format and is consumed by most GIS packages, including ESRI, MapInfo, and QGIS.
Click on Layer | CreateLayer | New GeoPackage Layer. Alternatively, in the Browser panel, right-click on GeoPackage and choose Create Database. Both options bring you to the same window:
- In the New GeoPackage Layer window, click on the Browse button at the end of the label database and browse to a location where you want to store your GeoPackage
- Give the GeoPackage a database name, for example, New_Sites
- Click on OK and you will come back to the New GeoPackage Layer window
- Set the Table name and set the value to proposed_sites
- Set the Geometry type to Polygon
- Set the EPSG to 27700 'British National Grid' (if you are doing the follow along exercises): To do this, click on the globe icon at the end of the drop-down menu and filter on 27700
- In a new field, create the following columns and leave these as Text data types:
- site_name
- reference_number
- land_release_date
- proposed_construction_date
- proposal_type
- Click on OK to create the GeoPackage
We'll revisit New_Sites.gpkg later in this chapter.