In the first section of this chapter, you were able to load, display, and query rasters using gdal. In this section, you will learn how to load and query rasters using a spatial database—PostgreSQL. As you start to model your data, you will most likely hold it in a spatial database. You can leverage your database to perform the queries on your rasters.
Raster operations using PostgreSQL
Loading rasters into PostgreSQL
To load a raster into PostgreSQL, you can use the raster2pgsql binary. If it is not in your path, you may need to add it. You should be able to find the binary in your PostgreSQL install directory on Windows at \PostgreSQL\10\bin.
The following command should be executed from your operating system...