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

Fundamentals of a query-based syntax

Don’t worry if this section isn’t completely intuitive. Play around with simple queries to become familiar with how the queries are executed. In a nutshell, here are the foundational elements to remember when selecting data from tables. The columns have headings that need to be entered exactly as they are spelled in the source dataset. Don’t worry— we can change both table names and column headings. Have a look at the following syntax:

SELECT some_columns FROM some_data_source WHERE some_condition;

This will make sense when we begin thinking about data questions and what information to consider.

Changing column names

I write SQL keywords such as SELECT, FROM, WHERE in all caps to improve readability, but SQL is not case-sensitive. You can decide to use lowercase if you prefer. This is relevant when you begin renaming your tables when working within a database or GIS.

The data in Figure 2.11 is from the...