Summary

In this chapter, we took an in-depth look at the concept of storing spatial data in a database, using the freely available PostGIS database toolkit. We learned that spatial databases differ from ordinary relational databases in that they directly support spatial data types and use spatial indexes to perform queries and joins on spatial data. We saw that spatial indexes make use of the geometries' bounding boxes to quickly compare and find geometries based on their position in space.

We then looked at the PostGIS spatial extension to PostgreSQL and how the psycopg2 library can be used to access PostGIS spatial databases using Python. After installing the necessary software, we configured a spatial database and used psycopg2 to create the ...

Get Python Geospatial Development - Third Edition 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.