Book Image

Geospatial Analysis with SQL

By : Bonny P McClain
Book Image

Geospatial Analysis with SQL

By: Bonny P McClain

Overview of this book

Geospatial analysis is industry agnostic and a powerful tool for answering location questions. Combined with the power of SQL, developers and analysts worldwide rely on database integration to solve real-world spatial problems. This book introduces skills to help you detect and quantify patterns in datasets through data exploration, visualization, data engineering, and the application of analysis and spatial techniques. You will begin by exploring the fundamentals of geospatial analysis where you’ll learn about the importance of geospatial analysis and how location information enhances data exploration. Walter Tobler’s second law of geography states, “the phenomenon external to a geographic area of interest affects what goes on inside.” This quote will be the framework of the geospatial questions we will explore. You’ll then observe the framework of geospatial analysis using SQL while learning to create spatial databases and SQL queries and functions. By the end of this book, you will have an expanded toolbox of analytic skills such as PostGIS and QGIS to explore data questions and analysis of spatial information.
Table of Contents (13 chapters)
Free Chapter
Section 1: Getting Started with Geospatial Analytics
Section 2: SQL for Spatial Analytics

Understanding the SQL query builder in QGIS

We have been building SQL queries in DB Manager thus far, but there is one more tool that is useful when writing SQL syntax in large datasets. In the SQL window (visible when you select the icon in the top-left menu), there is a SQL symbol located in the upper-left corner of the console. It opens with a vertical list of SQL prompts.

  1. Columns lists the actual columns in the database tables, which you can select using the dropdown on the far right in the Data section. Once you select a table, all of the columns in the dataset are displayed as follows:
Figure 8.1 – The SQL query builder inside the SQL window in QGI

Figure 8.1 – The SQL query builder inside the SQL window in QGI

  1. Where is populated when you select Columns’ values in the right-hand vertical section in Figure 8.2. The column value in the data column will populate and display the variables listed in the column of interest. In the example, values for landuse equal to residential will...