I wanted to use the PostGIS functionality raster2pgsql, but I had to discover that the Python function was not installed with my PostGIS installation.

Do you know if raster2pgsql is generally part of the PostGIS installation or do I have to install a special package?

I installed PostGreSQL and PostGIS on my mac via homebrew. > brew upgrade postgis tells my that the latest version is installed, which is obviously not the case (1.5.3 installed, but 1.5.5 available).

The complete installation is

select PostGIS_full_version();
POSTGIS="1.5.3" GEOS="3.3.2-CAPI-1.7.2" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.3" USE_STATS

According to the latest PostGIS docs on loading raster data:

The older version of this tool was a python script. The executable has replaced the python script. If you still find the need for the Python script Examples of the python one can be found at GDAL PostGIS Raster Driver Usage. Please note that the raster2pgsql python script may not work with future versions of PostGIS raster and is no longer supported.

To the question about versions, homebrew doesn't provide the latest version of a software package, it just provides the latest version that someone has packaged for homebrew. If the absolute latest isn't up there, then you won't get the absolute latest. An alternative source is KyngChaos.

If you are looking for the latest in raster processing for PostGIS I suggest checking out WKTRaster, too.


For PostGIS 1.5, there is no way to be using the latest raster support in PostGIS. You will need to be on PostGIS 2.0 for the latest public release.

BUT for your needs, you can simply download the python script from raster/scripts/python/raster2pgsql.py from any recent source tarball. I think you'll need numpy though...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.