wiki:WKTRaster/Documentation01

Version 2 (modified by pracine, 15 years ago) ( diff )

PostGIS WKT Raster Beta 0.1.6 Documentation


1 - Introduction

WKT Raster is an extension of PostGIS aiming at aiming at developing support for raster. It is a new project very different from the previous PGRaster project and also very different from Oracle GeoRaster…

WKT Raster's goal is to implement the RASTER type as much as possible like the GEOMETRY type is implemented in PostGIS and to offer a single set of overlay SQL functions (like ST_Intersects) operating seamlessly on vector and raster coverages.

WKT Raster…

  • is as simple as PostGIS…


Load your raster data using gdal2wktraster.py and make your queries! In WKT Raster…

  • RASTER is a new column type (like the PostGIS GEOMETRY type)
  • one table with a column of type raster = one raster coverage (like a one table PostGIS vector coverage)
  • one table row with a column of type raster = one tile (like a vector coverage in which one row = one geometry)
  • each tile has: a pixel size, a width and a height, a georeference, a certain number of band, a pixeltype per band and a nodata value per band; everything essential to do basic GIS raster operations.
  • is an extension of PostGIS to be installed separately

You can install WKT Raster over any version of PostGIS higher than 1.3.5. Merge with PostGIS might occur in the future…

  • has a loader similar to shp2pgsql.exe (gdal2wktraster.py)…
  • allowing loading of a single raster or a set of rasters (using wildcard) into a tiled coverage.
  • supporting as many file format as GDAL does.
  • allows easy conversion from raster to geometry…
  • RT_AsPolygon(raster) → geometry
  • introduces raster/geometry seamless geometry constructors…
  • so you don't have to bother whether the layers you are working with are in raster or vector form when using analysis functions.
  • RT_Intersection(raster|geometry, raster|geometry, "raster"|"geometry") → raster/geometry
  • and seamless geometry operators…
  • raster|geometry && raster|geometry → boolean
  • RT_Intersects(raster|geometry, raster|geometry) → boolean
  • allows raster storage INSIDE the database (as WKB)…
  • for efficient overlay analysis operations between vector and raster layers…
  • or OUTSIDE the database (as JPEG or TIFF)…
  • so desktop and web applications can quickly access and load raster tiles and nevertheless benefits from the powerful PostGIS GiST spatial index. Every WKT Raster SQL functions working with in-the-db raster tiles work seamlessly with out-the-db raster tiles.
  • is much more simple than PGRaster and Oracle GeoRaster! WKT Raster supports…
  • only one type (instead of two in Oracle Spatial: SDO_GEORASTER & SDO_RASTER). In WKT Raster there are no differences between rasters and tiles: a tile is a raster and a raster is a tile. i.e. one row = one tile = one raster; one table = one raster coverage.
  • no metadata (like PostGIS)
  • no masks (you can create a mask as a band)
  • no multiple dimensions (only two: x, y)
  • no pyramids (reduced resolution coverages can be stored as a separate layer)

1.1 - Credits

Sponsoring

  • Steve Cumming, University Laval, sponsored project management kick-start and core implementation.
  • CadCorp sponsored WKB and datum format design and implementation.

Development

  • Pierre Racine designed the functionality.
  • Sandro Santilli wrote the in-memory api, build scripts and postgresql connectors.
  • Mateusz Loskot wrote the loader (gdal2wktraster.py) and most "getter" functions.

1.2 - More Information

2 - Installation

2.1 - Requirements

WKT Raster is dependent on:

2.2 - Installing Precompiled Binaries

Windows and Linux binaries should be available soon on the WKT Raster Home Page.

2.3 - Compiling and Installing from Sources

2.3.1 - Compiling on Linux

  1. Follow the instructions to compile PostGIS.
  2. Using a SVN client, retrieve the WKT Raster source from http://svn.osgeo.org/postgis/spike/wktraster
  3. From the wktraster directory, run:
>./configure

  1. Run the compile and install commands:
>make & make install

PostgreSQL provides a utility called pg_config to enable extensions like PostGIS to locate the PostgreSQL installation directory. If ./configure didn't find pg_config, try using the —with-pgconfig=/path/to/pg_config switch to specify a particular PostgreSQL installation.

All files are installed using information provided by pg_config:

  • Core functionality (rtpostgis shared library) is installed in [pkglibdir]/lib/
  • SQL function file (rtpostgis.sql) is installed in [prefix]/share/contrib
  • Loader (gdal2wktraster.py) is installed in [bindir]/

2.3.2 - Compiling on Windows using MSYS/MinGW

To be revised.

2.3.3 - Compiling on Windows using Visual Studio

2.3.4 - Final Installation

  1. Load the PostGIS WKT Raster object and function definitions into your database by loading the rtpostgis.sql definitions file.

psql -d [yourdatabase] -f rtpostgis.sql

The PostGIS WKT Raster extensions should now be loaded and ready to use.

3 - FAQ

3.1 - What is the meaning of "WKT" in WKT Raster?

3.2 - How is WKT Raster different than the Oracle SDO_GEORASTER and SDO_RASTER types?

3.3 - Why do you say "WKT Raster goal is to implement the RASTER type as much as possible like the GEOMETRY type is implemented in PostGIS"? Vector and raster are very different and have always been threated differently in GIS packages.

3.4 - Why does every tile is georeferenced?

3.5 - How come it is possible to store overlapping rasters in the same table? In a raster, tiles should not overlaps.

4.6 - How do a load my raster in the database using WKT Raster?

4.7 - How do I dump my raster from the database into the filesystem using WKT Raster?

4 - Using PostGIS WKT Raster

4.1 - The PostGIS WKT Raster Type

Like the PostGIS "geometry" type, WKT Raster "raster" type is a new PostgreSQL type. This mean each raster or raster tile is stored as a row of data in a database table. It is a complex type embedding many informations about each raster (width, height, number of band, pixeltype for each band and nodatavalue for each band) and its geolocalisation (pixelsize, upper left pixel center, rotation and SRID).

4.2 - Integration with PostGIS

4.3 - Loader/Dumper

4.4 - Building Indexes

4.5 - Examples

5 - Uploading Strategy & Performance Tips

6 - PostGIS WKT Raster Reference

6.1 - Management Functions

6.2 - Raster Relationship Functions

6.3 - Raster Processing Functions

6.4 - Raster Accessors

6.5 - Raster Constructors

6.6 - Raster Operators

6.7 - Raster Outputs

6.8 - Raster Editors

7 - Reporting Problems


Appendix

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.