I'm trying to follow the instructions here to load a raster into a PostGIS database:
python raster2pgsql.py -s 4269 -I -r *.tif -F myschema.demelevation -o elev.sql
I understand that I replace *
with the path to my raster, but I don't understand the part myschema.demelevation
or elev.sql
. Should I have my own schema for this file? And what does the elev.sql
part mean?
I also read through the gdal PostGIS raster driver to try and understand this with more examples. Similarly, they suggest loading a raster katrina
python raster2pgsql.py -r /path/to/katrina.tif -t katrina -l 1 -k 64x64 -o katrina.sql -s 4326 -I -M
Using my current setup, I tried loading the katrina
raster in:
python2.6 ~/src/postgis-2.0.0SVN/raster/scripts/python/raster2pgsql.py -r ~/tmp/katrina.tif -t katrina -l 1 -k 64x64 -o katrina.sql -s 4326 -I -M
However, I got the following errors:
Traceback (most recent call last):
File "/home/src/postgis-2.0.0SVN/raster/scripts/python/raster2pgsql.py", line 34, in <module>
from osgeo import gdal
File "/home/lib/python2.6/GDAL-1.8.1-py2.6-linux-i686.egg/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/home/lib/python2.6/GDAL-1.8.1-py2.6-linux-i686.egg/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: /home/lib/python2.6/GDAL-1.8.1-py2.6-linux-i686.egg/osgeo/_gdal.so: undefined symbol: GDALSetRasterUnitType
I don't fully understand these errors mean; when I compiled gdal
should I have specified an argument for GDALSetRasterUnitType
?
More generally, I'm having difficulty understanding why I am not specifying the database that I am trying to load this data into.
After following MerseViking's advice I ran:
python /usr/lib/postgresql/8.4/bin/raster2pgsql.py -r /home/celenius/Downloads/katrina.tif -t katrina -l 1 -k 64x64 -o katrina.sql -s 4326 -I -M
which returned the following output:
------------------------------------------------------------
Summary of GDAL to PostGIS Raster processing:
------------------------------------------------------------
Number of processed raster files: 1 (/home/celenius/Downloads/katrina.tif)
List of generated tables (number of tiles):
1 katrina (256)
Then I ran:
psql -d test -f katrina.sql - U postgres -W
which returned the following:
addrastercolumn
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public.katrina.rast srid:4326 pixel_types:{8BUI,8BUI,8BUI} out_db:false regular_blocking:true nodata_values:NULL scale_x:'0.029325513196481' scale_y:'-0.029325513196481' blocksize_x:'64' blocksize_y:'64' extent:POLYGON((-100.014662756598 9.98533724340176,-100.014662756598 40.0146627565982,-69.9853372434018 40.0146627565982,-69.9853372434018 9.98533724340176,-100.014662756598 9.98533724340176))
(1 row)
(END)
This message and a blinking cursor appear on screen. I assume that it is loading into the database, but I'm not sure. The tif
file is just 3MB - I had assumed that it would not take long to load a file of this size but the blinking cursor has already been on the screen for ~1 hour. Has this crashed or do I just need to wait a long time?
I have 4GB of RAM and a dual-processor of 2.5 GHz.
q
, that it executes this command, and inserts the data into the databasetest
. Is this normal behavior and should I be doing this?