Changes between Version 4 and Version 5 of frmts_wtkraster.html


Ignore:
Timestamp:
Sep 20, 2009, 8:40:53 AM (15 years ago)
Author:
jorgearevalo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • frmts_wtkraster.html

    v4 v5  
    11= '''GDAL WKT Raster driver documentation''' =
    22
     3[[BR]]
    34
    45= '''1 - Introduction''' =
     
    1011  * Out-db raster support.
    1112  * Create and modify rasters.
    12   * Integration with the GDAL utility programs.
     13  * Full integration with the GDAL utility programs.
    1314
    1415== '''1.1 - Credits''' ==
     
    3536 * [http://postgis.refractions.net/ PostGIS] version 1.4.0 or higher
    3637 * [http://trac.osgeo.org/postgis/wiki/WKTRaster WKTRaster PostGIS extension] version 0.1.6SVN or higher
     38 * [http://www.python.org/ Python] version 2.5 or higher and [http://pypi.python.org/pypi/GDAL/ GDAL for Python] version 1.6.0 or higher for the loader (gdal2wktraster.py).
     39
    3740 
    3841== '''2.2 - Installed precompiled binaries''' ==
     
    6063The GDAL library with the WKT Raster driver hasn't been yet compiled on Windows.
    6164
     65
    6266= '''3 - Using GDAL WKT Raster driver''' =
    6367
    6468== '''3.1 - Loading raster data''' ==
    6569
     70The GDAL WKT Raster driver isn't able to load raster data yet. For this proposal, you'll have to use '''gdal2wktraster''' script. This loader script is included with the WKT Raster extension installation, under the ''scripts'' subdirectory. To check the syntax of the script, execute this command from ''$WKT_RASTER/scripts'' subdirectory:
     71
     72{{{
     73>$ python gdal2wktraster.py --help
     74}}}
     75
     76'''Important:''' If you want to load raster data with out-db storage system, you'll have to apply [http://trac.osgeo.org/postgis/ticket/227 this patch] to the gdal2wktraster script. Please, take into account that this patch has not been included to the gdal2wktraster version on official WKT Raster extension. It's only a beta version.
     77
     78Example 1:
     79
     80Load [http://www.gis4free.org/gdal_wktraster_autotest/autotest/gdrivers/data/utm.tif this one-band grayscale image] (utm.tif) to PostGIS using loader script:
     81
     82{{{
     83>$ python gdal2wktraster.py -r utm.tif -t utm -l 1 -k 100x100 -o utm.sql -s 26711 -I -M
     84}}}
     85
     86In this example, the script generates a SQL output (redirected to the file ''utm.sql''). This SQL code adds the image ''utm.tif'' to PostGIS, using a regular blocking arrangement with blocks of 100x100px. To execute the code, you must run this command as '''postgres''' user:
     87
     88{{{
     89>$ psql -d <wktraster_database> -f utm.sql
     90}}}
     91
     92The ''wktraster_database'' must be a PostgreSQL database with PostGIS and WKT Raster extensions enabled.
     93
     94Example 2:
     95
     96Load [http://www.gis4free.org/gdal_wktraster_autotest/autotest/gdrivers/data/small_world.tif this RGB image] (small_world.tif) to PostGIS using loader script:
     97
     98{{{
     99>$ python gdal2wktraster.py -r small_world.tif -t utm -l 1 -k 40x20 -o small_world.sql -s 4326 -I -M
     100}}}
     101
     102As in ''Example 1'', this code generates a SQL file, called ''small_world.sql'' with the SQL code to add the image ''small_world.tif'' to PostGIS using a regular blocking arrangement with blocks of 40x20px. To execute the code, as '''postgres''' user, run:
     103
     104{{{
     105>$ psql -d <wktraster_database> -f small_world.sql
     106}}}
     107
     108
     109Example 3:
     110
     111Using the first image (utm.tif), let's create an overview of the image of half size in PostGIS.
     112
     113{{{
     114>$ python gdal2wktraster.py -r utm.tif -t utm -l 2 -V -k 100x100 -o utm.sql -s 26711 -I -M
     115}}}
     116
     117The key concept here is the '''-V''' flag. This flag allows loader script 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.
     118
     119The '''-l 2''' flag represents the overview level. 2 means an overview of the 50% of the original image size.
     120
    66121== '''3.2 - Reading data''' ==
     122
     123If you want to use the GDAL WKT Raster driver, you must provide a '''connection string''' as Dataset's name. The syntax of this connection string is (respect the quotes):
     124
     125
     126{{{
     127 PG":host='<host>' dbname='<dbname>' user='<user>' password='<password>' table='<raster_table>' [where='<sql_where>' mode='<working_mode>']"
     128}}}
     129
     130Note that the string, until the part that starts with "table='" is a libpq-style connection string. That means that you can change the order of these fields (dbname, user, password, host), or leave out unnecessary ones (like password, in some cases). But the rest of the connection string must have the syntax and order shown above.
     131
     132The "table" option requires the name of a WKT Raster table. This table only can be created by using the script gdal2tiles, from [http://trac.osgeo.org/postgis/wiki/WKTRaster WKTRaster code]
     133
     134The "where" option is used to filter the results of the raster table. Any SQL-WHERE expression is valid. The "mode" option is used to know the expected arrangement of the raster table. As the driver is currently working with only one table arrangement (regularly blocked tables), you can omit this option, or use it with value "REGULARLY_TILED_MODE". Otherwise, the driver won't work.
     135
     136You must use this dataset's format in all the gdal tools, like gdalinfo, gdal_translate, gdalwarp, etc.
     137
    67138
    68139== '''3.3 - Creating and modifying data''' ==