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

Null values in PostgreSQL

Before we dive into analysis, it is important to understand what null signifies and what we can do with it. Briefly, in Postgres, NULL has no value. It doesn’t equal 0, so you can’t use it in mathematical calculations. In a nutshell, it indicates a field without a value. In large datasets, it makes sense that not all columns contain data. In the case of OSM, perhaps that street has not been labeled with a name or the identity of that building is unknown. It doesn’t mean the value is nothing but that it is unknown. In the PostgreSQL database, there are different scenarios where NULL is the expected value – this differs in each coding language, so be vigilant (and curious).

The data we will use for the rest of this chapter can be found in the GitHub repository mentioned earlier and includes Rondinia.gdb. As a reminder, we will locate the downloaded files in the Browser area, add them to the canvas, and bring them into PostgreSQL...