Database Reference
In-Depth Information
$ gdal_translate -projwin 6.619 47.095
18.515 36.649 PG:"host=localhost
port=5432 dbname='postgis_cookbook'
user='me' password='mypassword'
schema='chp01' table='tmax_2012_multi'
mode='2'" tmax_2012_multi.tif
4. There is another GDAL command, gdalwarp , that is still a convert utility
withreprojectionandadvancedwarpingfunctionalities.Youcanuseit,forex-
ample, to export a PostGIS raster table, reprojecting it to a different spatial
reference system. This will convert the PostGIS raster table to GeoTiff and
reproject it from EPSG:4326 to EPSG:3857 :
gdalwarp -t_srs EPSG:3857
PG:"host=localhost port=5432
dbname='postgis_cookbook' user='me'
password='mypassword' schema='chp01'
table='tmax_2012_multi' mode='2'"
tmax_2012_multi_3857.tif
How it works...
Both gdal_translate and gdalwarp cantransformrastersfromthePostGISras-
ter to all the GDAL-supported formats. To have a complete list of the supported
formats,youcanusethe --formats optionofoneoftheGDAL'scommandlineas
follows:
$ gdalinfo --formats
For both these GDAL commands, the default output format is GeoTiff; if you need
a different format, you must use the -of option and assign to it one of the outputs
produced by the previous command line.
Inthisrecipe,youhavetriedsomeofthemostcommonoptionsforthesetwocom-
mands.Astheyarecomplextools,youmaytrysomemorecommandoptionsasa
bonus step.
Search WWH ::




Custom Search