PGCHIP - The GDAL Postgis driver for raster data | |||
|
|||
Purpose | |||
The aim of PGCHIP driver is to provide an interface between GDAL and Postgis. GDAL is a translator library for raster geospatial data formats and Postgis is spatial extension to PostgreSQL open source object-relational database management system. This project is not an OGR interface to Postgis, if you are looking for this (vector oriented code), you may want to check the PostgreSQL OGR driver. | |||
How does Postgis deal with rasters ? | |||
It does not. However, a special type named CHIP exists in Postgis source. A few functions are also available to manipulate any data that would be stored in a CHIP object. | |||
Why not using GDAL to develop a full raster data extension inside Postgis ? | |||
GDAL provides a very good interface for driver implementation. Its design enables a quick and easy development of new raster formats wrappers. Moreover, the utility programs are great for testing the new driver and for converting raster files to Postgis CHIP datatype. Adding raster support inside Postgis would imply to modify its source to optimize the chip struture and functions. However, it would certainly be a good idea to get involved in Postgis developement to move some of the PGCHIP drivers functions inside the database engine. By doing this way, we keep the 2 projects completely independant. | |||
Important driver restrictions | |||
|
|||
How do I install the PGCHIP driver ? | |||
REQUIREMENTS
: * Make sure you have a full PostgreSQL/Postgis clean source installation * You need to have Proj4 installed and configured in Pstgis to get the driver work INSTALL NOTES : 1* Go to frmts directory under GDAL source tree 2* Unpack pgchip archive in the frmts directory 3* Edit GNUMakefile to set your Postgis include path 4* Add registration entry point declaration : - Open gdal/gcore/gdal_frmts.h - Add "void CPL_DLL GDALRegister_PGCHIP(void);" between the CPL_C_START and CPL_C_END tags 5* Add a call to the registration function in frmts/gdalallregister.c In the GDALAllRegister() function add the followinf lines : #ifdef FRMT_pgchip GDALRegister_PGCHIP(); #endif 6* Add the format short name to the GDAL_FORMATS macro in GDALmake.opt.in (and to GDALmake.opt) : - Locate the variable GDAL_FORMATS and add "pgchip" (lowercase) to the list of formats 7* Add a format specific item to the EXTRAFLAGS macro in frmts/makefile.vc 8* Recompile your GDAL library : - make clean -./configure - make - make install |
|||
How can I test the driver ? | |||
You can choose to build your own application using the API or use the gdal utility tools. Some examples : $ gdaltranslate -of pgchip /DATA/myRaster.png
PG:host=192.168.1.1#dbname=mydb%layer=myRasterTable
This command line will insert create a table named myRasterTable and copy the raster data into it. You may want to export the newly inserted raster to another format : $ gdaltranslate -of bmp
PG:host=192.168.1.1#dbname=mydb%layer=myRasterTable /DATA/myRaster.bmp
|
|||
TODO List | |||
* Test driver compatibility with
various raster formats * Modify the connection string to cope with the name of the raster column * Improve the number of color interpretation options * Deal with more datatypes and geoTransform matrix * Improve SRID conversion * Test makefile.vc (Visual C) * ... |
|||
Download | |||
pgchip-1.1.tar.gz | |||
Author information and bug report | |||
simon (dot) benjamin (at) free (dot) fr | |||