Chapter 4. Working with PostGIS

In this chapter we will cover the following topics:

  • Executing a PostGIS ST_Buffer analysis query and exporting it to GeoJSON
  • Finding out whether a point is inside a polygon
  • Splitting LineStrings at intersections using ST_Node
  • Checking the validity of LineStrings
  • Executing a spatial join and assigning point attributes to a polygon
  • Conducting a complex spatial analysis query using ST_Distance()

Introduction

A spatial database is nothing but a standard database that can store geometry and execute spatial queries in their simplest forms. We will explore how to run spatial analysis queries, handle connections, and more, all from our Python code. Your ability to answer spatial questions such as "I want to locate all the hotels ...

Get Python Geospatial Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.