Spatial Databases – Build Your Spatial Data Empire
What are Spatial Databases in GIS?
Spatial databases provide a strong foundation for accessing, storing, and managing your spatial data empire.
A database is a collection of related information that permits the entry, storage, input, output, and organization of data. A database management system (DBMS) serves as an interface between users and their databases.
A spatial database includes location. It has geometry as points, lines, and polygons. GIS combines spatial data from many sources with many different people. Databases connect users to the GIS database.
For example, a city might have the wastewater division, land records, transportation, and fire departments connected and using datasets from common spatial databases. Let’s take a closer look at spatial databases and how we use them in GIS.
What is an attribute table in GIS?
Spatial features store where objects are located on a map. But the attribute table explains what the objects on the map represent. For example, this could be anything from a category of plant to a land cover type or population value.
Attribute tables are similar to spreadsheets.
FIELDS have different types such as text (strings), integers (whole numbers), and dates (YYYY/MM/DD). Field names are the title of the column names. A field name should be descriptive of the information that you enter in the column. For example, the average population may have a field name of AVG_POP.
ROWS in an attribute table represents a spatial feature in the data set or an associated record of that data set.
Rows in an attribute can have relationships with spatial features. There are three types of relationships:
- One-to-one relationship
- One-to-many relationship
- Many-to-many relationship
One-to-one relationships tie one table with one table
What are one-to-one relationships in GIS? When you link one feature to one entry in a table, this is a one-to-one relationship (1-1).
What’s unique about Geographic Information Systems is that one table ties into geographic coordinates. For example, here are the geographic locations of three cities in Germany:
As you can see, we can get some extra information about these five cities. We learn their latitude and longitude. Not only that, but we see additional information like their population.
One-to-many relationships tie multiple records from a table together
What are one-to-many relationships?
When you associate one spatial feature with multiple records in an attribute table this is a one-to-many relationship (1-M). In this case, there is a unique identifier in the spatial table that uniquely identifies each row in a table. These keys must exist in both the spatial and non-spatial attribute table.
This unique ID (primary key) is the primary linkage between geographic data and the attribute table. This key must exist in the related table as a foreign key. You can set up a 1-M relationship class by connecting unique IDs.
For example, one survey site can have multiple observations over several years. The survey site would have geographic coordinates. The table that it ties with would have corresponding records associated with that unique ID. The two fields that link up these attribute tables are the primary keys and must exist in both tables.
You can see how we are reducing redundancy. We are no longer storing the latitude and longitude in each observation. This is because each latitude and longitude is only being stored once in the survey points table.
Many-to-many relationships in GIS are much less common in GIS. This type of relationship exists when there are many entries in related attribute tables and vice versa. You can generate an intersection table to associate many records together.
Relational database management system (RDBMS)
What is a relational database management system (RDBMS)?
As explained above, the two fields that link up these attribute tables are the ID of the primary key. What ties these tables together is the user setting up a 1-M relationship.
This is an example of an RDBMS.
RDBMS is a relational storage concept for data. A relational database contains tables that hold records. Each record holds fields containing data for that record.
It uses normalization to separate tables and link tables together. Normalization doesn’t waste space. It breaks out information into discrete components. RDBMS reduces repetitive information. In the example above, we take out duplicate information into multiple tables. There’s a foreign key on one table and we can gain access to that table through a relationship.
RDBMS can get very complex such as in the example below:
What is Boolean Algebra?
Boolean algebra consists of conditions used to select features with a set of algebraic conditions. Conditions include AND, OR, or NOT.
When you filter the displayed features in the map by setting up a definition query using Boolean algebra. For example, CITY = “LARGE” AND COUNTRY = “NORTH AMERICA” would filter out all the records that meet these criteria.
In GIS, Boolean algebra creates a set of conditions used to select features with a set of algebraic conditions. Conditions include AND, OR, or NOT. We use Venn Diagrams to represent Boolean operations. The name Boolean algebra originated by founder George Boole in 1847.
Structured Query Language (SQL) is how users can interact with the database using Boolean algebra.
Spatial Database Examples
Here are some examples of spatial databases:
- Proprietary Esri File Geodatabases store vector data, raster data, tables, topology, and relationships. Schemas ensure data integrity. File geodatabases offer structural, performance, and data management advantages.
- Open source PostGIS adds spatial objects to the cross-platform PostgreSQL database. The three features that PostGIS delivers to PostgreSQL DBMS are spatial types, indexes, and functions. With support for different geometry types, the PostGIS spatial database allows querying and managing information about locations and mapping.
- Other database examples include SQL Server (where geometry is just another data type, like char and int) and Microsoft Access (known as a personal geodatabase in ArcGIS).
Spatial databases provide a mechanism for multiple users to simultaneously access shared spatial data – similar to a DBMS.
READ MORE: What is a Geodatabase? Personal vs File Geodatabase
The Final Word on Spatial Databases
A database management system (DBMS) allows users to store, insert, delete, and update information in a database.
RDBMS takes it a step further. It reduces redundancy through normalization. It links tables together through primary and foreign keys.
Spatial databases go a step even further because they record data with geographic coordinates.
From geodatabases to PostGIS, spatial databases have quickly become the primary method of managing spatial data.
Start your spatial data empire using spatial databases.