Introduction to Geospatial Databases

In the previous chapters, you learned how to set up your Python environment and learned about the different libraries available for working with geospatial data using Python. In this chapter, you will start working with data.

Databases provide one of the most popular ways to store large amounts of data, and one of the most popular open source databases is PostgreSQL. PostGIS extends PostgreSQL, adding geographic objects and the ability to query records spatially. When PostgreSQL and PostGIS are combined, they create a powerful geospatial data repository.

Geospatial databases improve on basic relational database queries by allowing you to query your data by location or by location to other features in the database. You can also perform geospatial operations such as measurements of features, distances between features, and converting between projections. Another feature of geospatial databases is the ability to create new geometries from existing features from a buffer, union, or clip operation.

This chapter will cover the basics of geospatial databases. In this chapter, you will learn:

  • How to install PostgreSQL and PostGIS
  • How to install and use pyscopg2 to connect to the database
  • How to add data to a database
  • How to perform basic spatial queries
  • How to query length and area
  • How to query for points within a polygon

In Chapter 7Geoprocessing with Geodatabases, we will come back to geospatial databases and you will learn more advanced operations and how to display your data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset