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

Detecting patterns, anomalies, and testing hypotheses

Once we learn how to import data and view the tables, the next step is to ask better questions. You will eventually develop skills to build bigger queries, but in this dataset, we are now interested in complaints about indoor air quality and defining a particular neighborhood, Brownsville. The location of the complaints is displayed in Figure 2.18.

Run the following code in the QGIS query builder:

SELECT * FROM ch3."DOHMH_Indoor_Environmental_Complaints"
WHERE "Complaint_Type_311" = 'Indoor Air Quality' AND "NTA" ='Brownsville'

The utility of SQL queries to ask specific questions that filter data down to address the impacted communities is clearly observed:

Figure 2.18 – Filtering data in QGIS for a specific area

Figure 2.18 – Filtering data in QGIS for a specific area

Historically, Brownsville was identified as the most dangerous neighborhood in Brooklyn. Additional data questions might include...