PostGISRaster --- PostGIS Raster driver

PostGIS Raster (previously known as WKT Raster) is the project that provides raster support on PostGIS. Since September 26st, 2010, is an official part of PostGIS 2.0+.

This driver was started during the ​Google Summer of Code 2009, and significantly improved since then.

Currently, the driver provides read-only support to PostGIS Raster data sources.

Connecting to a database

To connect to a PostGIS Raster datasource, use a connection string specifying the database name, with additional parameters as necessary

PG:"[host=''] [port:''] dbname='' [user=''] [password=''] [schema=''] [table=''] [column=''] [where=''] [mode=''] [outdb_resolution='']"

Note that the string, up to the part starting with "table='" is a libpq-style ​connection string. That means that you can leave out unnecessary fields (like password, in some cases).

Additional notes

If a table stores a tiled raster and you execute the driver with mode=1, each image tile will be considered as a different image, and will be reported as a subdataset. There are use cases the driver can't still work with. For example: non-regular blocked rasters. That cases are detected and an error is raised. Anyway, as I've said, the driver is under development, and will work with more raster arrangements ASAP.

There's an additional working mode. If you don't provide a table name, the driver will look for existing raster tables in all allowed database' schemas, and will report each table as a subdataset.

You must use this connection string's format in all the gdal tools, like gdalinfo, gdal_translate, gdalwarp, etc.

Performance hints

To get the maximum performance from the driver, it is best to load the raster in PostGIS raster with the following characteristics:


To get a summary about your raster via GDAL use gdalinfo:
gdalinfo  "PG:host=localhost port=5432 dbname='mydb' user='postgres' password='secret' schema='public' table=mytable"

For more examples, check the PostGIS Raster FAQ section: ​Can I export my PostGIS Raster data to other raster formats?


The driver developers

See Also