Changes between Version 47 and Version 48 of frmts_wtkraster.html


Ignore:
Timestamp:
Mar 8, 2012, 4:27:53 AM (12 years ago)
Author:
jorgearevalo
Comment:

Updated raster loading information

Legend:

Unmodified
Added
Removed
Modified
  • frmts_wtkraster.html

    v47 v48  
    8282== '''3.1 - Loading raster data in the database''' ==
    8383
    84 The GDAL PostGIS Raster driver does not support writing raster to the database yet. For this, you'll have to use the [http://postgis.refractions.net/documentation/manual-svn/RT_reference.html#RT_Loading_Rasters raster2pgsql] python script. This script is included with the PostGIS installation in the ''raster/scripts/python'' subdirectory. To check the syntax of the script, execute this command from that subdirectory:
     84The GDAL PostGIS Raster driver does not support writing raster to the database yet. But you can load raster data in the database in 2 ways:
    8585
    86 {{{
    87 >$ python raster2pgsql.py --help
    88 }}}
     86 * [http://postgis.refractions.net/documentation/manual-svn/using_raster.xml.html#RT_Raster_Loader Using raster2pgsql to load rasters]
     87 * [http://postgis.refractions.net/documentation/manual-svn/using_raster.xml.html#RT_Creating_Rasters Creating rasters using PostGIS Raster functions]
    8988
    90 '''Important:''' The out-db raster support for PostGIS Raster is still under development. Please, don't use this option.
    91 
    92 '''Example 1''':
    93 
    94 Load [http://dl.dropbox.com/u/6599273/utm.tif this one-band grayscale image] (utm.tif) on PostGIS using loader script:
    95 
    96 {{{
    97 >$ python raster2pgsql.py -r /path/to/utm.tif -t [schema.]utm -l 1 -k 64x64 -o utm.sql -s 26711 -I -M
    98 }}}
    99 
    100 In this example, the script generates a SQL output (redirected to the file ''utm.sql''). This SQL code, when executed in PostgreSQL create a new table with the image ''utm.tif''. It will be tiled as regular blocking arrangement with blocks of 64x64px. Each image block will be a row of the raster table. To execute the code in PostgreSQL, you must run this command from the console:
    101 
    102 {{{
    103 >$ psql -d <raster_database> -f utm.sql -U <user> -W
    104 }}}
    105 
    106 ''raster_database'' must be a PostgreSQL database with the PostGIS Raster extension enabled. ''user'' must have privileges to create tables and insert values in the database.
    107 
    108 '''Example 2''':
    109 
    110 Load [http://dl.dropbox.com/u/6599273/katrina.tif this RGB image] (katrina.tif) in PostGIS using the loader script:
    111 
    112 {{{
    113 >$ python raster2pgsql.py -r /path/to/katrina.tif -t katrina -l 1 -k 64x64 -o katrina.sql -s 4326 -I -M
    114 }}}
    115 
    116 As in ''Example 1'', this code generates a SQL file, called ''katrina.sql'' with the SQL code to add the image ''katrina.tif'' to PostGIS using a regular blocking arrangement with blocks of 64x64px. Again, a new raster table will created and each image block will be stored in one row of the raster table. To execute the code, type:
    117 
    118 {{{
    119 >$ psql -d <raster_database> -f katrina.sql -U <user> -W
    120 }}}
    121 
    122 
    123 '''Example 3''':
    124 
    125 Using the second image (katrina.tif), you can load a lower resolution overview of the image (containing only a quarter of the pixels) in PostGIS.
    126 
    127 {{{
    128 >$ python raster2pgsql.py -r /path/to/katrina.tif -t katrina -l 2 -V -k 64x64 -o katrina_ov2.sql -s 4326 -I -M
    129 }}}
    130 
    131 The key options are:
    132  * The '''-V''' flag. This flag makes the loader to create a new table to store the overviews' metadata. If you want to load several images with overviews, you'll have to use this flag '''only the first time''' the loader script is called, to create the overviews' metadata table only once.
    133  * The '''-l 2''' flag. This flag forces the loader script to create a table with a GDAL-provided overview of the original file, with an overview factor of 2. This is, half size.
    134 
    135 As usual, to execute the generated SQL code, run this command:
    136 
    137 {{{
    138 >$ psql -d <raster_database> -f katrina_ov2.sql -U <user> -W
    139 }}}
    140 
     89The write support to GDAL PostGIS Raster driver is under development.
    14190== '''3.2 - Reading raster data from the database''' ==
    14291