Add "where" to your life

How to install and configure PostGIS Raster on Windows

March 10, 2011

A lot of people ask me about how to use PostGIS Raster and the GDAL PostGIS Raster driver in Windows systems. And most of them are, comprehensibly, using the last stable releases of both libraries (PostGIS and GDAL). The problem is PostGIS Raster and GDAL driver are being developed in these moments. There’s no stable release, so far.

PostGIS Raster was included as official part of PostGIS in October 2010. The old version, formerly named WKT Raster has been abandoned. So, if you want to use PostGIS Raster, with new functionalities and many bugs fixed, you’ll have to use the latest PostGIS development snapshot. The use of the old WKT Raster extension is strongly unrecommended, and there’s no support for it.

About GDAL, there was an important change in the driver on October 20st, 2010. A new version was committed, and this is the only version that works with PostGIS Raster. This new driver version was included in the release 1.8.0, currently the stable release. So, the use of an older release to connect with PostGIS Raster is also unrecommended.

With these facts in mind, I understand the Windows users who want to use PostGIS Raster and the GDAL driver are a bit unprotected. I’m not a Windows user, but I consider it my fault. For this reason, I’ve decided to create this howto. I’m going to install and configure PostGIS Raster and GDAL in Windows. And fortunately, you don’t need to compile anything. Let’s go for it:

Step 2: Installing GDAL

I think the easiest way to have a complete GDAL installation (library + binaries + Python bindings) working on Windows is using the GDAL binaries mantained by Tamas Szekeres, here. Last GDAL versions from trunk are compiled daily with MSVC 2003, MSVC 2005 and MSVC 2008. Pick one. For example, the version compiled with MSVC 2003, here.

WARNING: This directory (GDAL Python bindings location) may not exist in your GDAL installation. In my case, the bindings are in C:\Python27\Lib\site-packages\osgeo, and I didn’t need to define this variable.

PYTHONPATH=C:\Program Files\GDAL\python

UPDATE 2011-07-19: I think I introduced some confusion in the comments. I apologize for that. Several people are having problems with GDAL Python bindings. I’ll try to make it clearer:

On one hand, there’s a sure thing: you need GDAL library + GDAL Python bindings installed in your system. There’s an easy way of doing it, by executing the generic installer: gdal-18-1310-core.msi. This installer includes the Python bindings, and they’re installed at C:\Program Files\GDAL\python directory by default. This should be enough.

If you previously have a Python interpreter and a GDAL version installed on your system (check it from a console, executing gdalinfo –formats), you may want to simply install the proper GDAL Python bindings. Let’s assume your GDAL version is 1.8 (lower versions won’t work with PostGIS Raster), and your Python version is 2.7. Then, you simply need to install GDAL-1.8.0.win32-py2.7.msi. This installer will put GDAL Python bindings at C:\Python27\Lib\site-packages by default. This is a different location than above, but at the end, you should have a working version of GDAL Python bindings on your system.

Finally, the PostGIS Windows experimental binaries with PostGIS Raster support (step 4) are packed with their own version of GDAL library, used only by the raster2pgsql loader.

GDAL installed. Now, let’s go with step 3

Step 3: Installing PostgreSQL

I recommend Postgresql 8.4.x or higher. You can download the 1-click-installer from here, and install it in the common Windows’ way.

During the installation, you’ll be asked to install some nice additional stuff using the Application Stack Builder, like PostGIS 1.5.x or PostGIS 1.4.x. Don’t install anything. The PostGIS versions that can be installed doesn’t include PostGIS Raster. And you can’t install it separately, because, remember, now is part of PostGIS. We’re going to install last PostGIS version by hand. Don’t be afraid, it’ll be easy.

Following the instructions of README.txt file, let’s edit makepostgisdb.bat to adapt the vars to our enviroment. We may want to change these vars:

set PGPORT=5432
set PGHOST=localhost
set PGUSER=postgres
set PGPASSWORD=password_of_postgres_user
set THEDB=template_postgis20
set PGBIN=C:\Program Files\PostgreSQL\8.4\bin\
set PGLIB=C:\Program Files\PostgreSQL\8.4\lib\
After that, we make a backup of our PostgreSQL bin and lib directories (PGBIN and PGLIB). Just in case.

We now execute makepostgisdb.bat. Take into account you may want to execute the script as administrator, in case your Windows user doesn’t have needed privileges (it was my case).

UPDATE 2011-06-08: For all Windows XP Professional SP2 users:

when you run makepostgisdb.bat from the binaries of POSTGIS SVN2.0, please rename the libiconv-2.dll in bin folder of Postgresql/8.4/bin folder to any other name. Now run the makepostgisdb.bat file. You will not get any error of “operation aborted …. transaction block” (Thanks to C Patnaik)

Once executed, we have PostGIS 2.0 + PostGIS Raster installed and configured. A new database called template_postgis20 is created, enabled with PostGIS and PostGIS Raster. Easy! Let’s test it with the next query:

Of course, you can create your own database using template_postgis20 as template. From the command line:

createdb -U postgres -T template_postgis20 your_database

Or from pgAdmin III:

Creating new database from template in pgAdmin III

If you want to use the SHP2PGSQL GUI, you must copy the postguisgui folder (inside bin folder in the downloaded PostGIS experimental binaries file) into pgAdmin III folder (mine is C:\Program Files\pgAdmin III\1.12) and add the next lines to plugins.ini file, inside pgAdmin III folder too:

As result of this step, a SQL file named image.sql will be created in the directory where you executed the Python line above.

In the second step, you’ll need to load the SQL file in your_database, by using your favourite PostgreSQL client. For example, pgAdmin. If your use the psql command line client, the line to execute is:

psql -h localhost -U postgres -d your_database -f image.sql

If you want to translate your raster data from the database to image files at disk again, execute gdal_translate.

Basically, this is all what you need to work with PostGIS Raster in Windows. Anyway, take into account the next additional notes:

Additional notes:

In step 2, I installed the whole GDAL library, including binaries and Python bindings. In step 4, I installed PostGIS 2.0 with all its pre-requisites. One of them is GDAL. The optimal way would be to use the existent GDAL library, but we’re working with pre-compiled binaries and DLLs. So, we have 2 copies of GDAL library:

C:\Program Files\GDAL\gdal18.dll: Installed with generic installer for GDAL, in step 2. Used by gdal_translate, when reading data from database, and in any operation involving GDAL, except the raster loading with raster2pgsql.py script

Both library files were compiled from GDAL 1.8.0 from trunk. But they will be slightly different, for sure. This is a suboptimal solution, of course, but it shouldn’t cause problems, because libgdal.dll is only used when loading raster data into the database. The rest of operations involving GDAL will be executed linking with gdal18.dll

If you want to translate the raster data to any image format different from TIFF, you can use the -of option in gdal_translate. For example:

UPDATE 2011-06-11: I changed the gdal_translate line. I’m using the ‘postgres’ user and the ‘trust’ method to authenticate this user (so, no password is needed), but it’s only a simplification. In general, you should use a different user and a password-enabled authentication method, like md5. Thanks to C.Patnaik again, because his comment remainded me this issue

Conclussions:

It’s possible to work with the last version of PostGIS Raster and GDAL PostGIS Raster driver in Windows, but assuming that:

You’re using experimental build. Not recommended for production enviroments.

You have to install GDAL Python bindings. Do it following instructions in step 2, by using the GDAL generic installer for core components. Choose the “complete” installation or the custom installation, if you want to manually choose the components to install. In that case, be sure the last option (Python bindings) is selected.

Sounds like your console is using a locale unsupported by Python. To help you, I should know the python version you’re running and the locale of your console. If you’re using Python 3.x, you should try executing this:

when i make new database and it’s tamplate is postgis20 it create
2 schemas the first one “public”
contain one table “raster_overviews”
and the second schema called “topology”
which contain two tables “layer and topology”
and no tables called “raster_columns”.

Inside that zip file, there are several SQL files with all the functions and tables you need to activate a new or existent PostgreSQL database with PostGIS and PostGIS Raster. These SQL files are inside \share\contrib\postgis-2.0 folder.

Your PATH var should include more things. For example, if you open a console and put “dir” on it, you’ll get a directory listing. This is because the path to “dir” binary is part of PATH enviroment var.

Open a console and put:

set

You’ll get all your enviroment vars. PATH between them. You’ll have to see the complete path to GDAL binaries (I guess C:\Program Files\GDAL\bin), and the path to your gdal18.dll file (I guess C:\Program Files/opengeo/opengeo suite/).

i build a new enviroment with postgres9.0 and postgis-pg90-binaries-2.0.0svn, the postgis20 template contain “raster_columns”
there is no error in raster2pgsql.py command and take alot of time to convert one image .jpg in to one table with one row but i could’t see it becouse there is an error on the starting the web site
ERROR: function force_2d(geometry) does not exist
so what i can do please?

the jpg size 1.45 MB it is converted in to one table with only one row is this correct?
but i can’t see it on the map and there is no erorrs
i changed the extent of the map but still nothing seen although it is added as a layer in the legend map!

thank you for replay,
the log file of postgres told me that when i opened the raster table:
2011-03-31 14:15:23 EET LOG: could not receive data from client: No connection could be made because the target machine actively refused it.

For all Windows XP Professional SP2 users:
when you run makepostgisdb.bat from the binaries of POSTGIS SVN2.0, please rename the libiconv-2.dll in bin folder of Postgresql/8.4/bin folder to any other name. Now run the makepostgisdb.bat file. You will not get any error of “operation aborted …. transaction block”. I discovered it the hard way, Jorge!! As long as this file exists, the batch file does not do the Xcopy and then the prob starts. Cheers!

raster2pgsql.py [with its arguments of -r, -t and -o] – when invoked from python throws an error mentioning OCI.dll could not load. This pops up 3-4 times followed by the message : “Cant load requested dll: C:\gdal\bin\gdal\plugins\gdal_GEOR.dll. The specified module could not be found.” I have this file in its proper place and environment properly set ! In spite of this message, the corresponding sql file gets created and has been successfully incorporated in postgreSQl->PGAdminIII.
I assume this error is non-fatal.

You can borrow the OCI.dll file from any software installed on any Windows machine or get from a reliable site. Put this OCI.dll in the GDAL folder [I have also put in the PostgresQL folder] It works and it stops the gdal_GEOR.dll error too.

Hi, I’m getting the dreaded “ImportError: No module named osgeo” message when trying to run raster2pgsql. GDAL seems to be working otherwise. I set PYTHONPATH=C:\Program Files\GDAL\python but I now see that there is no \GDAL\python folder……is this the problem? I used the core components installer and selected “complete”.

Stevie, please download the mapserver version of GDAL called “release-1500-gdal-1-8-0-mapserver-6-0-0”. Run this. This will create a GDAL version on C:\ only. This will have python too but in C;\GDAL\bin\gdal\python. Please maintain this GDAL installation separate from C:\Program Files\GDAL.

Which of these do I need? I have python 2.6 so I thought it made sense to install “GDAL-1.8.0.win32-py2.6.exe” and “gdal-18-1500-core.msi”, but you mentioned GDAL would install to just “C:\GDAL” but it installed in “C:\Program Files\GDAL”. So now I’m not sure which PATH to set, etc.

Stevie, you should simply install “GDAL-1.8.0.win32-py2.6.exe”. This file installs GDAL at C:\Program Files\GDAL by default. As result of that installation, you’ll get C:\Program Files\GDAL\gdal18.dll. This is the GDAL library used in your system.

Apart from this, when you install PostGIS 2.0 using PostGIS Windows experimental binaries, you get C:\Program Files\PostgreSQL\8.4\bin\libgdal.dll. This version of GDAL library is only used by the raster2pgsql.py loader, to read raster data from disk. The rest of the operations involving GDAL use the previous GDAL library, installed in step 2 at C:\Program Files\GDAL

For Windows XP SP2 users: [Jorge, I would help out with Windows components as the ball rolls!]:
In the event of the following error with gdal_translate
“error checking geometry type existence: Is PostGIS correctly installed? No connection to the server.”
Please do the following:
1. Open the configuration file C:\Program Files\PostgreSQL\8.4\data\pg_hba.conf in notepad.
2. Optionally you may read thru the file OR do the next step:
3. For a stand alone system: change the METHOD to “trust”. [towards the end of the file].
But for a server based system please chek the server connection and establish proper authentications accordingly. Your sys admin can help you out.

1. Once a raster is loaded into PostGreSQl database, how do we get the
>> attribute values. We tried the ST_Values but it displayed on screen or
>> into an Excel file. We would like to store them in a db file to be
>> accessed later. How?
>>
>> 2. How to view changes on the raster in real time after running an SQL
>> query? Should linkages be established to OpenEV/Fwtools? If so, how? We
>> need a display system, something like what ARC/INFO or ARCView does.
>>
>> 3. How to optimise the run time for running SQLs on large images, say,
>> 10000×10000 lines and pixels (~400 MB). We have tried GIST indexes but
>> still it takes 15-20 minutes.
>>
>> 4. How to dump results onto the table/new table? We need these results as
>> an accessible field in the table.
>>
>> 5. How to run a mathematical model or any algorithm specific to a raster
>> in conjunction with other attributes/values?
In short how do we read/load raster attributes and use them for further zonating regions on image for analysis?

Did you install the Python interpreter from http://www.python.org/download/releases/? What happens if you open a command line (cmd.exe), write python and hit enter key? It should show you the python interpreter.

If you get an error instead, maybe you installed python only for a user of your machine, and you’re in another user’ session. I’m not a Windows user, but I think you should be able to install Python interpreter for all your machine’s users. I did it with Windows 7 for this tutorial.

If you’re sure you installed Python properly and still get that error, you should try adding the path to Python interpeter (C:\Python26\python.exe in my case) to the PATH enviroment variable. You have instructions on how to do this:

It worked as you said except for 2 cases: one was minor: in step 4, the bat file needs to be edited so that the xcopy commands are copying the files form postgis2.0 to postgres bin folders.

but i havent quite gotten the raster support to work. when i try
python “C:\Program Files\Postgresql\8.4\bin\raster2pgsql.py” –help

i get ‘no module named osgeo’

should i try editing the raster2pgsql.py and remove the osge reference? i do have various Paths defined as in your post, except
– in step 2:PYTHONPATH=C:\Program Files\GDAL\python : i dont python under the GDAL folder
-and mmy path to Python is set as C:\Python27 (not C:\Python27\python.exe)

Don’t modify raster2pgsql. The ‘osgeo’ include is necessary to work. The problem is your system can’t find the GDAL Python bindings. The PYTHONPATH enviroment var must point to the directory containing these bindings (osgeo directory, gdal.py, ogr.py, gdalconst.py, gdalnumeric.py). If you installed GDAL properly in step 2, you should see C:\Program Files\GDAL\Python directory.

Anyway, if you installed GDAL in a different location, please check it. Run a search in your system for gdal.py, or ogr.py. The directory containing these files is the directory that should be pointed by PYTHONPATH.

I installed GDAL from your link ‘generic installed for gdal core components’ which was gdal-18-1310-core.msi
This installer installed GDAL under C:\Program Files (x86)\GDAL
But it did not install a python folder under the above.

And ‘import osgeo’ in a Python installer gives me an error like ‘…import error: no module named osgeo’

Also, i searched for gdal.py and ogr.py on my machine- i found them under a different application on my machine (QGIS) under gdal-17 (which i guess is not what we want anyway for this exercise).

Last, in your additional notes you refer to
“C:\Program Files\PostgreSQL\8.4\bin\libgdal.dll: Installed with PostGIS Windows experimental binaries, in step 4. Used by raster2pgsql.py script, to load raster data into PostgreSQL”
In my case, I have
C:\Program Files (x86)\PostgreSQL\9.0\bin\libgdal-1.dll

Jorge, i speak some spanish, but am not a native speaker. for example i cant do technical spanish:) i am originally from India, live in Davis, California right now.
I am developing some geospatial information tools and would like to connect a bit more with the community. we are a non-profit research group and dont have in-house web-programming skills to develop the kinds of application i would like to. Still, I have some good experiences with GRASS-R-PHP -Postgis that I would like to take further…perhaps with interns or in some collaborative fashion…
cheers,
Vishal

Hi Jorge,
I was trying to do what you wrote regarding Postgis raster on Win, but I stacked somewhere…pls can you help me to solve this:
I downloaded postgis-pg84-binaries-2.0.0svn.zip and extracted on C, than I made all this changed in makepostgisdb.bat, and when run it as admin I got following massage in cmd:

good now is work when i make from osgeo import gdal ( when i install GDAL-1.8.0.win32-py2.6.exe with gdalMSV …)
But Now i work in python console and i have a image called torn.tiff in C : i write this in python console:

Thank you for this information
Then it’s back to the command (cmd.exe), after I set the directory python (python.exe) in the path:::
C: \ Python26 to PATH and
PYTHONPATH to C: \ Python26 \ Lib \ site-packages
But there are some errors in syntax near surtoout C: Program Files???

Now succeded in binding GDAL on python, but i dont think this PostGIS Windows experimental binaries is running properly becuase it was saying some file can not be found while i ran it.
The template_postgis2.0 it created does not have a raster column.
I did not see any file like libgdal.dll in the postgres bin folder
I only saw 2 schemas the first one “public”
contain one table “raster_overviews”
and the second schema called “topology”

Please Jorge, how can i get this postgis2.0 working in my machine.
Does it has have both vector geometry functions as well as raster?

About your problem, I assume you followed my instructions. So, let’s see how all pieces work. First of all, which version of GDAL, Python, PostgreSQL and PostGIS are you using? I mean the concrete exe name tou used to install each program.

Now, perform these tests:

GDAL: execute gdalinfo –formats or gdalinfo –version in cmd. If there’re no errors, we can assume GDAL is properly installed (check version is 1.8.x)

Python: from cmd, execute python interpreter (simply write python and hit ENTER). If you see the Python command line, we can assume Python is properly installed

GDAL python bindings: from Python command line, write: import gdal. And hit ENTER. If you get an error “ImportError: No module named gdal”, the bindings are not installed.

PostgreSQL + PostGIS 2.0: Execute a PostgreSQL client (pgAdmin or psql) and connect to your template_postgis20 database (and tell me how many tables this schema has, and their names). Then, execute this query:

select postgis_full_version()

And paste here the information you get.

If any of these steps cause an error, paste it here, as detailed as possible.

Jorge,
both gdalinfo-format or version and python are said not recognised as an internal or external operable programs or batch files.
Could this be the problem?, but i called up python command line or the python GUI and typed ‘import gdal’ and it worked.
Is really tiring!

Jorge,
on the template_postgis20 database schema, i have only one table called raster_overviews
and i did ran this query : select postgis_full_version()
and it gave me this :
ERROR: function postgis_full_version() does not exist
LINE 1: select postgis_full_version()
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

********** Error **********

ERROR: function postgis_full_version() does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 8

And about PostGIS, the error tells me your database has not been spatially enabled. Delete the database “template_postgis20” and manually create it. Then, connect with it and execute, in order, the files:

1.- postgis.sql
2.- spatial_ref_sys.sql
3.- rtpostgis.sql

Thy should be in the directory created when you unzipped PostGIS Windows experimental binaries.

Jorge, thanks for this help, we really have to get this working on my system.

I have added the directory paths for GDAL and PosgreSQL as you said.
Deleted and Created manually the templete_postgis20 table
then try to execute the first file postgis.sql on this table
comes this error message:
ERROR: could not access file “$libdir/postgis-2.0”: No such file or directory

********** Error **********

ERROR: could not access file “$libdir/postgis-2.0”: No such file or directory
SQL state: 58P01

Jorge,
in which directory should i unzipp this folder, postgis-pg90-binaries-2.0.0svn
becuase I discovered that when i run the ‘makepostgisdb’ file, nothing is copied from this postgis-pg90-binaries-2.0.0svn folder.
Becuase it says File not found, 0 File copied.
That means all the neccesary files that should be copied from that folder to postgres directory are not copied. Which are supposed to be copied in by this statements
xcopy bin\*.* “%PGBIN%”
xcopy /I /S bin\postgisgui\* “%PGBIN%\postgisgui”
xcopy lib\*.* “%PGLIB%”

Ok. So, the problem is your “PostGIS enviroment” hasn’t been set, and the DLL files are not found. Execute the BAT file from the command line, to see the output (not from the Windows explorer).

Unzip the file wherever you want. The important thing is to execute the BAT file. Once unzipped, the files under ‘bin’ directory are copied to PGBIN, and ‘lib’ files are copied to PGLIB. Ensure these enviroment variables point to the right directories: the ‘bin’ and ‘lib’ directories of your PostgreSQL installation. Probably:

Jorge, please can you give me a little bit detail on this command line execution?.
Because when i click Run as Administrator, it automatically executes it on the ‘black’ command line. Am really not too sure of what to do right now.

Jorge,
i was trying to paste the screenshot here, but am not sure if images can be pasted here because it could not be pasted. If there another way i can send u the screen shot, please i will glad to do that immediately.
There were errors everywhere that the files don’t exist.

Hai Jorge, thanks for the information.
I have try this on my windows 7 but those steps do not give same result.
There is no PostGIS Raster in my PostgreSQL tree (but you have , based on screenshot above).
Can you give me advices about that? Please send me by email to wendiadriansaga@yahoo.com.
Thank you.

can you let me know how to install Mercator and PostGIS Raster which are displayed on screenshot of SHP2PGSQL GUI installed under pgAdmin III above?
Because they are not appear on my PostgreSQL.
Please advise. Thanks.

HI,
I have followed all your step to install postresql in my machine having OS windows 7 home premium.As such I installed python 2.7, related numpy extension(i.e.numpy-1.5.1-win32-superpack-python2.7), GDAL core and binding( GDAL-1.8.0.win32-py2.7)as well. I create the environment for GDALtoo. After that I install PostgreSQL 9.1 and PostGIS 2.0. Up to this everything is ok. I can create a table with a data type raster as well as geometry. Now the Problem in loading *.tif file using raster2pgsql.py with command line. Error is as :

Hello jorgearevalo,
Thanks for your reply.
In the place C:\Program Files\PostgreSQL\9.1\bin\ there is libgdal-1.dll instead of libgdal.dll. However I set the system path for C:\Program Files\PostgreSQL\9.1\bin and still not working. Shall I have to change libgdal-1.dll to libgdal.dll or not?

Hi Jorge,
Though I have install PostGIS 2.0, I think there was a problem in the installation of it thats why I am facing the problem mentioned above. Actually when I first run the makepostgisdb.bat it gave error even in copying file from Postgis unzipped folder to postgresql folder. Later I did first four step of makepostgisdb.bat file manually i.e. copied my self in the respective folder of postgresql. These are the following four steps

And then I removed these four line and run the batch file with administrator and it runs with some error. When I connected the database with pgadmin I found only three table in postgis 2.0 templete and are:

– spatial_ref_sys
– raster_columns
– raster_overviews

where as geometry_column and geography_column appear in a views folder.

So now I can create the raster and vector table using script by create command but facing problem in loading thats why my intuition is that there is problem in running the batch file.
I though it might be security issue of windows 7 and even disable the firewall and antivirus and run the batch file from command prompt but still not working .

Maybe there are some changes in the latest Postgis 2.0.0 binaries, because it worked before, but now I’m getting the same error. I tried this with Postges 8.4 and 9.0, Python 2.6.6 and 2.7.1. No change. I’m getting the same error from Python console.

Earlier there was an error when I executed from osgeo import gdal from Python conlsole. I forgot to set C:\Program Files (x86)\GDAL\ to my PATH environment variable (I’m on 64 bit Windows 7). Now it works. Thanks!

Hi Jorge,
Yes earlier there was error on running the from osgeo import gdal . Then I again install binding and set again path variable now I can load raster via raster2pgsql.py loader.

But I would like share the problem in running makepostgisdb.bat file in windows .As mentioned in my earlier post while running batch file it still unable to copy the files from postgis bin, lib etc to postgresql bin , lib etc. I did manually these things and run the batch file by removing these lines.
Yes I able to run now the batch but it runs with error and finally I obtained three table in templete_postgis20 folder as
– spatial_ref_sys
– raster_columns
– raster_overviews

where as geometry_column and geography_column appear in a views folder.

Anyway,so far I have access some functions related to raster and they work well if I get error in some case of-course I remember you on that time. Thanks

Another things I would like to know about the source code for raster datatype especially “geomval” how it construct. Do you have idea about it if yes can you please provide me the link for it . Thanks a lot.

You should add C:\Program Files\Postgresql\9.0\bin to your PATH enviroment variable. Other way, you could change to that directory in your command line:

cd “C:\Program Files\Postgresql\9.0\bin”

And then execute raster2pgsql without the path

raster2pgsql.py -r /path/to/image.tif -t tablename -o image.sql

But I’d chose the first option (add the path to PostgreSQL bin directory to PATH variable)

To load a SQL file via pgAdmin III, you need to:
1.- Open pgAdmin III and open a connection to your database
2.- Click in the SQL button in the menu bar
3.- In the new Window, choose “Open” and select your SQL file
4.- Once the file is open, Click on the “play” button (or hit F5 in your keyboard). This will execute the sql file against your database, like psql does.

If you’ve loaded the SQL file generated by raster2pgsql.py into your PostGIS Raster-activated database, you actually got it. The raster file you specified with ‘-r’ parameter is imported in your database.

Anyway, the PostGIS Raster visualization is related with the GDAL PostGIS Raster driver. You can use it (GDAL 1.8.0 or superior. Check http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html), but It’s under development. I’d love to devote more time to this task, and I’m actually working on it (until end of 2011, I couldn’t work on it harder). Stay tuned, because I’ll notifiy here when I finish a complete and stable version.

And don’t worry about questions. I’m the first one with a looooooot of things to learn. I still consider myself as a ‘GIS n00b’ 🙂

I can successfully import shapefiles into my DB and view them in QGIS. My problem is with the raster2pgsql.py function (I replaced the calls to “print” with “print()”, following python 3). When I run (with no line break):