[gdal-dev] gdalinfo on PostGIS rasters (GDAL 1.9)

James Hiebert hiebert at uvic.ca
Wed Nov 7 14:55:43 PST 2012


Mathieu,

Might be a couple things going on, but have you properly set the georeferencing properties of your raster?  What is the output of
SELECT st_georeference([raster_column]) from myraster

If they're not set, then you essentially just have a picture in your database (which is why it displays properly in QGIS, but it's probably showing it in pixel space).

See here:
http://postgis.refractions.net/docs/RT_ST_GeoReference.html
http://postgis.refractions.net/docs/RT_ST_SetGeoReference.html

Or you can use ST_SetScale, ST_SetUpperLeft, and ST_SetSkew to do the same thing.

~James

On Wed, Nov 07, 2012 at 05:30:26PM -0500, Mathieu Basille wrote:
> Dear GDAL developers,
> 
> I am currently working with a PostGIS data base, which contains a few 
> rasters imported from .img raster files. The rasters work properly in 
> PostGIS, and are displayed properly in QGIS. They are projected as WGS84 
> (SRID 4326). They were imported using raster2pgsql, such as:
> 
> $ raster2pgsql -s 4326 -t 25x25 -I -C -M -F raster.img myschema.myraster | 
> psql -h localhost -d mydb -U pguser
> 
> In PostGIS, the raster seem fine (they look OK in 'raster_columns'). 
> However, if I try to access them using gdalinfo, I only get wrong 
> information (i.e. empty raster, wrong coordinate system, etc.). For example:
> 
> $ gdalinfo "PG:dbname=mydb host=localhost user=pguser schema=myschema 
> table=myraster"
> Driver: PostGISRaster/PostGIS Raster driver
> Files: none associated
> Size is 0, 0
> Coordinate System is:
> PROJCS["ETRS89 / ETRS-TM33",
>      GEOGCS["ETRS89",
>          DATUM["European_Terrestrial_Reference_System_1989",
>              SPHEROID["GRS 1980",6378137,298.257222101,
>                  AUTHORITY["EPSG","7019"]],
>              TOWGS84[0,0,0,0,0,0,0],
>              AUTHORITY["EPSG","6258"]],
>          PRIMEM["Greenwich",0,
>              AUTHORITY["EPSG","8901"]],
>          UNIT["degree",0.0174532925199433,
>              AUTHORITY["EPSG","9122"]],
>          AUTHORITY["EPSG","4258"]],
>      UNIT["metre",1,
>          AUTHORITY["EPSG","9001"]],
>      PROJECTION["Transverse_Mercator"],
>      PARAMETER["latitude_of_origin",0],
>      PARAMETER["central_meridian",15],
>      PARAMETER["scale_factor",0.9996],
>      PARAMETER["false_easting",500000],
>      PARAMETER["false_northing",0],
>      AUTHORITY["EPSG","3045"],
>      AXIS["Northing",NORTH],
>      AXIS["Easting",EAST]]
> Origin = (0.000000000000000,0.000000000000000)
> Pixel Size = (1.000000000000000,1.000000000000000)
> Subdatasets:
> ... [list of all tiles]
> Corner Coordinates:
> Upper Left  (   0.0000000,   0.0000000) ( 10d30'40.52"E,  0d 0' 0.01"N)
> Lower Left  (   0.0000000,   0.0000000) ( 10d30'40.52"E,  0d 0' 0.01"N)
> Upper Right (   0.0000000,   0.0000000) ( 10d30'40.52"E,  0d 0' 0.01"N)
> Lower Right (   0.0000000,   0.0000000) ( 10d30'40.52"E,  0d 0' 0.01"N)
> Center      (   0.0000000,   0.0000000) ( 10d30'40.52"E,  0d 0' 0.01"N)
> 
> Detailed set-up:
> * PostGIS 2.1.0SVN (r10597)
> * GDAL 1.9.0, released 2011/12/29
> * OS: Debian Wheezy
> 
> My ultimate goal is actually to import these rasters in R, but it seems 
> that my first problem is between GDAL and PostGIS. Is there anything I'm 
> doing wrong here?
> 
> Of course, I'd be happy to provide more information if required. Any advice 
> would be greatly appreciated!
> 
> Mathieu Basille.
> 
> 
> PS: I hope I'm using this list properly. Please let me know if you feel 
> that the question should be addressed to postgis-devel instead.
> 
> -- 
> 
> ~$ whoami
> Mathieu Basille, PhD
> 
> ~$ locate --details
> University of Florida \\
> Fort Lauderdale Research and Education Center
> (+1) 954-577-6314
> http://ase-research.org/basille
> 
> ~$ fortune
> « Le tout est de tout dire, et je manque de mots
> Et je manque de temps, et je manque d'audace. »
>   -- Paul Éluard
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
James Hiebert
Lead, Computational Support
Pacific Climate Impacts Consortium
http://www.pacificclimate.org
Room 112, University House 1, University of Victoria
PO Box 1700 Sta CSC, Victoria, BC V8V 2Y2
E-mail: hiebert at uvic.ca
Tel: (250) 472-4521
Fax: (250) 472-4830


More information about the gdal-dev mailing list