How to do it...

The steps you need to follow to complete this recipe are as follows:

  1. Import all the maximum average temperature rasters in a single PostGIS raster table using raster2pgsql and then psql (eventually, pipe the two commands if you are in Linux):
      $ raster2pgsql -d -I -C -M -F -t 100x100 -s 4326       worldclim/tmax*.bil chp01.tmax_2012 > tmax_2012.sql      $ psql -d postgis_cookbook -U me -f tmax_2012.sql
  1. Check how the table was created in PostGIS, querying the raster_columns table. Here we are querying only some significant fields:
      postgis_cookbook=# SELECT r_raster_column, srid,      ROUND(scale_x::numeric, 2) AS scale_x,       ROUND(scale_y::numeric, 2) AS scale_y, blocksize_x,  blocksize_y, num_bands, pixel_types, nodata_values, out_db ...

Get PostGIS Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.