Changes between Version 105 and Version 106 of WKTRaster/Documentation01
- Timestamp:
- 09/17/10 12:33:08 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WKTRaster/Documentation01
v105 v106 1 = '''PostGIS WKT Raster Beta 0.1.6Documentation''' =1 = '''PostGIS Raster Beta Documentation''' = 2 2 3 3 [[BR]] … … 5 5 = '''1 - Introduction''' = 6 6 7 WKTRaster is an extension of PostGIS 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...8 9 WKTRaster'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.7 PostGIS Raster is an extension of PostGIS 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... 8 9 PostGIS 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. 10 10 11 11 For a list and description of already implemented functions and examples of using them, please 12 also refer to [http://www.postgis.org/documentation/manual-svn/RT_reference.html WKTRaster Functions Reference].13 14 ''' WKTRaster...'''12 also refer to [http://www.postgis.org/documentation/manual-svn/RT_reference.html PostGIS Raster Functions Reference]. 13 14 '''PostGIS Raster...''' 15 15 16 16 17 17 '''...is as simple as PostGIS...'''[[BR]] 18 18 [[BR]] 19 Load your raster data using gdal2wktraster.py and make your queries! In WKTRaster...19 Load your raster data using gdal2wktraster.py and make your queries! In PostGIS Raster... 20 20 21 21 * RASTER is a new column type (like the PostGIS GEOMETRY type) … … 55 55 '''...or OUTSIDE the database (as JPEG or TIFF)...''' 56 56 57 * so desktop and web applications can quickly access and load raster tiles and nevertheless benefits from the powerful PostGIS GiST spatial index. Every WKTRaster SQL functions working with in-the-db raster tiles work seamlessly with out-the-db raster tiles.57 * so desktop and web applications can quickly access and load raster tiles and nevertheless benefits from the powerful PostGIS GiST spatial index. Every PostGIS Raster SQL functions working with in-the-db raster tiles work seamlessly with out-the-db raster tiles. 58 58 59 59 '''...introduces the concept of raster objects...''' … … 62 62 63 63 64 '''...is much more simple than PGRaster and Oracle !GeoRaster! WKTRaster supports...'''65 66 * only one type (instead of two in Oracle Spatial: SDO_GEORASTER & SDO_RASTER). In WKTRaster 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.64 '''...is much more simple than PGRaster and Oracle !GeoRaster! PostGIS Raster supports...''' 65 66 * only one type (instead of two in Oracle Spatial: SDO_GEORASTER & SDO_RASTER). In PostGIS 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. 67 67 * no metadata (like PostGIS) 68 68 * no masks (you can create a mask as a band) 69 * no multiple dimensions (only two: x, y). Not to be confused with bands; WKTRaster DO supports multiband raster...69 * no multiple dimensions (only two: x, y). Not to be confused with bands; PostGIS Raster DO supports multiband raster... 70 70 * no pyramids (reduced resolution coverages can be stored as a separate layer) 71 71 … … 107 107 108 108 109 * For more information see [wiki:WKTRaster WKTRaster Home Page].109 * For more information see [wiki:WKTRaster PostGIS Raster Home Page]. 110 110 111 111 * Search for "WKT Raster" in the [http://postgis.refractions.net/pipermail/postgis-users/ PostGIS-users] and [http://postgis.refractions.net/pipermail/postgis-devel/ PostGIS-devel] forums archives or in [http://www.nabble.com/PostGIS-f1221.html Nabble] or write to these forums. … … 119 119 120 120 121 WKTRaster is dependent on:121 PostGIS Raster is dependent on: 122 122 123 123 * [http://www.postgresql.org/ PostgreSQL] version 7.2 or higher. … … 127 127 * [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). 128 128 129 * [http://www.gdal.org/ GDAL] version 1.6.0 or higher , for some of the [http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking01#Objective0.1.6e-Beingabletointersectvectorandrastertoproducevector. Objective 0.1.6e] features. This features are under development, and must be enabled during configure to use it. See section 2.3.1 - Compiling on Linux, to know how to enable them129 * [http://www.gdal.org/ GDAL] version 1.6.0 or higher. 130 130 131 131 == '''2.2 - Installing Precompiled Binaries''' == 132 132 133 133 134 Windows and Linux binaries are available in the [wiki:WKTRaster WKTRaster Home Page].134 Windows and Linux binaries are available in the [wiki:WKTRaster PostGIS Raster Home Page]. 135 135 136 136 == '''2.3 - Compiling and Installing from Sources''' == … … 140 140 1. Follow the [http://postgis.refractions.net/documentation/manual-1.3/ch02.html instructions to compile PostGIS]. 141 141 142 2. Get the WKTRaster source code. You have two options:142 2. Get the PostGIS Raster source code. You have two options: 143 143 144 144 * Download the latest development snapshot from http://postgis.refractions.net/download/ 145 145 146 * Using a SVN client, retrieve the very last WKTRaster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen:146 * Using a SVN client, retrieve the very last PostGIS Raster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen: 147 147 148 148 {{{ … … 206 206 207 207 208 7. Get the WKTRaster source code. You have two options:208 7. Get the PostGIS Raster source code. You have two options: 209 209 210 210 * Download the latest development snapshot from http://postgis.refractions.net/download/ 211 211 212 * Using a SVN client, retrieve the very last WKTRaster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen:212 * Using a SVN client, retrieve the very last PostGIS Raster source from http://svn.osgeo.org/postgis/spike/wktraster. In this case you will have to generate the "configure" script with autogen: 213 213 214 214 {{{ … … 241 241 '''2.3.4 - Final Installation''' 242 242 243 1. Load the PostGIS WKTRaster object and function definitions into your database by loading the rtpostgis.sql definitions file.243 1. Load the PostGIS Raster object and function definitions into your database by loading the rtpostgis.sql definitions file. 244 244 245 245 {{{ … … 249 249 You can also do this directly in a pgAdmin III query dialog box if you administer your database using this software. 250 250 251 The PostGIS WKT Raster extensionsshould now be loaded and ready to use.251 The PostGIS Raster extension should now be loaded and ready to use. 252 252 253 253 All files are installed using information provided by pg_config: … … 260 260 261 261 262 = '''3 - Using PostGIS WKTRaster''' =263 264 265 == '''3.1 - The PostGIS WKTRaster Type''' ==266 267 Like the PostGIS "geometry" type, the PostGIS WKT"raster" type is a new PostgreSQL type. This means each raster or raster tile is stored as a row of data in a PostgreSQL database table. It is a complex type, embedding information about the raster itself (width, height, number of bands, pixeltype for each band and nodata value for each band) along with its geolocalisation (pixelsize, upper left pixel center, rotation and SRID).268 269 '''3.1.1 - PostGIS WKTRaster Rationale'''270 271 WKTRaster was designed with many objectives, to accommodate a myriad of dataset structures and a diversity of applications:272 273 '''Objective 1: Simplicity, Complementarity and Functionality -''' PostGIS WKT Raster provides a "raster" type that complements the existing PostGIS vectorial "geometry" type. This new extension offers operators and functions that are similar to those available with the existing geometry type. They work in the same user-friendly manner, but are associated with a matricial geospatial data structure to support the use of rasters. PostGIS WKTRaster also includes a simple loader to import many raster formats into the database.274 275 '''Objective 2: Seamless Integration with the PostGIS geometry type -''' PostGIS WKTRaster enables PostGIS operators and functions to work seamlessly on both raster and geometry types, so that users:262 = '''3 - Using PostGIS Raster''' = 263 264 265 == '''3.1 - The PostGIS Raster Type''' == 266 267 Like the PostGIS "geometry" type, the PostGIS "raster" type is a new PostgreSQL type. This means each raster or raster tile is stored as a row of data in a PostgreSQL database table. It is a complex type, embedding information about the raster itself (width, height, number of bands, pixeltype for each band and nodata value for each band) along with its geolocalisation (pixelsize, upper left pixel center, rotation and SRID). 268 269 '''3.1.1 - PostGIS Raster Rationale''' 270 271 PostGIS Raster was designed with many objectives, to accommodate a myriad of dataset structures and a diversity of applications: 272 273 '''Objective 1: Simplicity, Complementarity and Functionality -''' PostGIS Raster provides a "raster" type that complements the existing PostGIS vectorial "geometry" type. This new extension offers operators and functions that are similar to those available with the existing geometry type. They work in the same user-friendly manner, but are associated with a matricial geospatial data structure to support the use of rasters. PostGIS Raster also includes a simple loader to import many raster formats into the database. 274 275 '''Objective 2: Seamless Integration with the PostGIS geometry type -''' PostGIS Raster enables PostGIS operators and functions to work seamlessly on both raster and geometry types, so that users: 276 276 277 277 * may use their prior knowledge of PostGIS in general, and of its geometry type operators and functions, when building SQL queries; … … 281 281 * expect existing applications to work with new data loaded as rasters without (many) changes (to a certain conceptual limit). 282 282 283 This makes PostGIS WKT Raster an abstraction level, not only over the raster format (like GDAL) or over the vector format (like OGR), but more generally over the two most used data structures in the geospatial industry (raster AND vector). Even if many operations performed on a vector object (e.g. all the functions working only on LINESTRING geometries) are not really possible to apply to raster objects, and if there are also some raster specific functions (e.g. ST_Resample() or ST_SetBandNoDataValue()) not working on vector objects, we think, and we will demonstrate as we extend PostGIS WKTRaster in the future, that most operations have their equivalent in both raster and vector worlds (e.g. ST_Intersections(), ST_Accum(), ST_Area(), ST_MapAlgebra()), even if this does not appear obvious at first sight.283 This makes PostGIS Raster an abstraction level, not only over the raster format (like GDAL) or over the vector format (like OGR), but more generally over the two most used data structures in the geospatial industry (raster AND vector). Even if many operations performed on a vector object (e.g. all the functions working only on LINESTRING geometries) are not really possible to apply to raster objects, and if there are also some raster specific functions (e.g. ST_Resample() or ST_SetBandNoDataValue()) not working on vector objects, we think, and we will demonstrate as we extend PostGIS Raster in the future, that most operations have their equivalent in both raster and vector worlds (e.g. ST_Intersections(), ST_Accum(), ST_Area(), ST_MapAlgebra()), even if this does not appear obvious at first sight. 284 284 285 285 We think that providing a single paradigm (SQL) for dealing with both rasters and vectors should allow developers to write better GIS applications, by simplifying graphical user interfaces and softening the learning curves. Developers should be able to build a unique graphical user interface to deal with raster and vector data, making users having to learn only one set of operators to work with vector data and raster data, instead of two. We think this should generally enhance users’ experiences with geospatial applications and allow them to focus on real geographic problems rather than struggling with data formats and structures. … … 287 287 We also think that this approach is compliant (at least in philosophy) with the ISO 19123 "Abstract Specification Schema for Coverage Geometry and Functions" specification (not to be confused with the OCG Web Coverage Service) in which a coverage can be represented as a point layer, a polygon layer, a TIN layer or a raster layer, and in which any positional value of the coverage is accessible without having to know the data structure upon which the coverage is based. 288 288 289 '''Objective 3: Storage Flexibility (in-db & out-db storage) -''' PostGIS WKTRaster enables the user to simply "register" basic metadata (pixeltype, with, height, georeference, etc…) of images stored in the filesystem, without having to actually load their data values into the database. This way, web or desktop applications:289 '''Objective 3: Storage Flexibility (in-db & out-db storage) -''' PostGIS Raster enables the user to simply "register" basic metadata (pixeltype, with, height, georeference, etc…) of images stored in the filesystem, without having to actually load their data values into the database. This way, web or desktop applications: 290 290 291 291 * do not have to retrieve images from the database but might instead access them directly from the filesystem (e.g. as JPEG files); 292 292 293 * can nevertheless use most PostGIS WKTRaster operators and functions on those rasters, transparently.293 * can nevertheless use most PostGIS Raster operators and functions on those rasters, transparently. 294 294 295 295 This is "out-db" storage as opposed to the more natural "in-db" storage. 296 296 297 '''Objective 4: Interoperability –''' WKT Raster uses GDAL (http://www.gdal.org/) as its main connector to filesystem raster files. GDAL is involved when loading rasters into the database (using the loader) and when working with out-db rasters. It enables WKTRaster to work with nearly a hundred different file formats. (For a complete list of supported file formats see http://www.gdal.org/formats_list.html). (GDAL is also used to implement some raster processing functions, but this is another matter.)298 299 Objectives 2 and 3 respond to the most discussed idea that "storing rasters in the database is slower and useless if it does not benefit from specific databases’ features". Objective 2 makes WKTRaster an analytical toolkit, going beyond the simple data format. Objective 3 ensures storage flexibility, retrieval efficiency and transparency to users. Both objectives benefit greatly from the indexing of raster data in the database.300 301 We believe that these additional functionalities (over other raster-in-the-database implementations) make WKTRaster much more than just a new raster format, but also a necessary complement to PostGIS.302 303 '''3.1.2 - PostGIS WKTRaster Implementation'''304 305 To fulfill these objectives, PostGIS WKTRaster implements a minimalistic yet complete raster data structure, and adopts a simple single-type and single-table relational schema. This data structure is very similar to the PostGIS geometry vector type structure, and very different, for example, from the Oracle Spatial SDO_GEORASTER and SDO_RASTER raster types.306 307 * '''A single raster type -''' In PostGIS WKTRaster there is no such thing as a raster and its raster tiles or an image and its image tiles. Even though single raster attributes may be considered tiles of a coverage or tiles of an image, any attribute of type raster is a complete and self sufficient georeferenced raster. It is not necessarily related to other rasters in the same table, and not necessarily located in a specific grid. This choice makes everything very simple and flexible, letting users and applications decide how they structure their data and how they name their raster elements (rasters, images, bitmap, blocks, tiles, etc…).308 309 * '''A single table relational schema –''' Similarly, in PostGIS WKTRaster there is not one table for storing the raster data (like Oracle Spatial SDO_RASTER) and another table for storing the georeference and the metadata (like Oracle Spatial SDO_GEORASTER). Everything is stored in a single raster attribute, and raster attributes composing a table are not necessarily related to each other to form a significant coverage.297 '''Objective 4: Interoperability –''' PostGIS Raster uses GDAL (http://www.gdal.org/) as its main connector to filesystem raster files. GDAL is involved when loading rasters into the database (using the loader) and when working with out-db rasters. It enables PostGIS Raster to work with nearly a hundred different file formats. (For a complete list of supported file formats see http://www.gdal.org/formats_list.html). (GDAL is also used to implement some raster processing functions, but this is another matter.) 298 299 Objectives 2 and 3 respond to the most discussed idea that "storing rasters in the database is slower and useless if it does not benefit from specific databases’ features". Objective 2 makes PostGIS Raster an analytical toolkit, going beyond the simple data format. Objective 3 ensures storage flexibility, retrieval efficiency and transparency to users. Both objectives benefit greatly from the indexing of raster data in the database. 300 301 We believe that these additional functionalities (over other raster-in-the-database implementations) make PostGIS Raster much more than just a new raster format, but also a necessary complement to PostGIS. 302 303 '''3.1.2 - PostGIS Raster Implementation''' 304 305 To fulfill these objectives, PostGIS Raster implements a minimalistic yet complete raster data structure, and adopts a simple single-type and single-table relational schema. This data structure is very similar to the PostGIS geometry vector type structure, and very different, for example, from the Oracle Spatial SDO_GEORASTER and SDO_RASTER raster types. 306 307 * '''A single raster type -''' In PostGIS Raster there is no such thing as a raster and its raster tiles or an image and its image tiles. Even though single raster attributes may be considered tiles of a coverage or tiles of an image, any attribute of type raster is a complete and self sufficient georeferenced raster. It is not necessarily related to other rasters in the same table, and not necessarily located in a specific grid. This choice makes everything very simple and flexible, letting users and applications decide how they structure their data and how they name their raster elements (rasters, images, bitmap, blocks, tiles, etc…). 308 309 * '''A single table relational schema –''' Similarly, in PostGIS Raster there is not one table for storing the raster data (like Oracle Spatial SDO_RASTER) and another table for storing the georeference and the metadata (like Oracle Spatial SDO_GEORASTER). Everything is stored in a single raster attribute, and raster attributes composing a table are not necessarily related to each other to form a significant coverage. 310 310 311 311 These choices make the PostGIS raster structure very similar to the existing PostGIS vector structure in which a layer can be geometrically topological or not, depending on the user data and their choices of application. … … 325 325 * a "complete image" (e.g. Landsat), 326 326 * an image "tile", 327 * a "raster object"; a new kind of raster object introduced by PostGIS WKTRaster resulting from the rasterization of a vector feature.327 * a "raster object"; a new kind of raster object introduced by PostGIS Raster resulting from the rasterization of a vector feature. 328 328 329 329 All these objects are different terminologies and concepts related to the general concept of "raster". We will use the latter term throughout the rest of this documentation. … … 343 343 f) '''a raster object coverage resulting from the rasterization of a vector coverage.''' Each vector feature becomes a small raster with the same extent as the original vector feature. This type of coverage is not necessarily complete, nor rectangular; tiles should be of different sizes and might overlap. It all depends on the characteristics of the vector layer being rasterized. An exhaustive (or continuous) layer of mutually exclusive geometries (without gaps or holes like a forest cover) would result in a raster object coverage in which significant pixels (withdata values) would not overlap, but non-significant pixels (nodata values) would. On the other end of the spectrum, a discontinuous layer of mutually exclusive geometries (like a lake or building layer) would result in a coverage of mostly disjoint raster objects. 344 344 345 '''''Table 1 - Characteristics of different possible raster table arrangements in PostGIS WKTRaster'''''345 '''''Table 1 - Characteristics of different possible raster table arrangements in PostGIS Raster''''' 346 346 347 347 || '''Arrangement''' || '''Global shape of[[BR]]composing raster''' || '''Missing tiles[[BR]]possible''' || '''Same size[[BR]]tiles''' || '''Tile overlap[[BR]]possible''' || '''Form a[[BR]]coverage?''' || … … 353 353 ||'''f) raster object coverage''' || any || no real tiles || no real tiles || yes || yes || 354 354 355 '''''Figure 1 - Different possible raster table arrangements in PostGIS WKTRaster'''''355 '''''Figure 1 - Different possible raster table arrangements in PostGIS Raster''''' 356 356 357 357 [[Image(WKTRasterArrangements.gif)]] 358 358 359 All these arrangements are possible, and as for a geometry layer which can be implicitly topological or not, PostGIS WKTRaster does not impose one over the other (even though types c) and d) and f) are the most practical for a GIS analyst). The fact that users of a database might (contrary to a raster file format) add or delete rows (or “tiles”) in a table, along with the fact that we must support variable-sized tiles (for vector to raster conversion), makes it very difficult to enforce a certain type of configuration.359 All these arrangements are possible, and as for a geometry layer which can be implicitly topological or not, PostGIS Raster does not impose one over the other (even though types c) and d) and f) are the most practical for a GIS analyst). The fact that users of a database might (contrary to a raster file format) add or delete rows (or “tiles”) in a table, along with the fact that we must support variable-sized tiles (for vector to raster conversion), makes it very difficult to enforce a certain type of configuration. 360 360 361 361 '''Regularly Blocked Table''' … … 369 369 Some blocks (or tiles) can be missing in a regularly blocked table. Missing tiles are assumed to be filled with the proper nodata value for each band as determined in the raster_columns table. 370 370 371 This regular tiling (or regular blocking) is expected from arrangements c) d) and e) in figure 1. PostGIS WKTRaster provides this mechanism because raster applications are often optimized to deal with these arrangements. There is, however, no mechanism to enforce (constrain) these criteria and, as mentioned above, adding, modifying or deleting a row from the table might break this regular blocking, and the regular_blocking attribute will not be automatically updated.371 This regular tiling (or regular blocking) is expected from arrangements c) d) and e) in figure 1. PostGIS Raster provides this mechanism because raster applications are often optimized to deal with these arrangements. There is, however, no mechanism to enforce (constrain) these criteria and, as mentioned above, adding, modifying or deleting a row from the table might break this regular blocking, and the regular_blocking attribute will not be automatically updated. 372 372 373 373 '''Structure of the "raster" Type''' … … 411 411 * "64 bits double" are -1.7*10-308 and 1.7*10308. 412 412 413 PostGIS WKTRaster is expressed in different forms, depending on the level at which it is referred:413 PostGIS Raster is expressed in different forms, depending on the level at which it is referred: 414 414 415 415 * '''WKT -''' "Well Known Text" refers to the human readable text format used when inserting a raster with ST_RasterFromText() (not yet implemented) and retrieving a raster with ST_AsText() (not yet implemented). This format can result in the loss of precision when used with floating point values. This is why the HEXWKB form is preferred when importing/exporting in textual form. … … 423 423 '''The raster_columns Table''' 424 424 425 Like the PostGIS "geometry_column" table, the PostGIS WKTRaster "raster_columns" table is a way for applications to get a quick overview of which tables have a raster column, and to get the main characteristics (metadata) of the rasters stored in these columns. Applications should maintain this table using the !AddRasterColumn() and !DropRasterColumn() functions, as there is no automatic mechanism in the database to keep this table up to date with every raster column created or deleted.425 Like the PostGIS "geometry_column" table, the PostGIS Raster "raster_columns" table is a way for applications to get a quick overview of which tables have a raster column, and to get the main characteristics (metadata) of the rasters stored in these columns. Applications should maintain this table using the !AddRasterColumn() and !DropRasterColumn() functions, as there is no automatic mechanism in the database to keep this table up to date with every raster column created or deleted. 426 426 427 427 Table 3 summarizes the attributes of the raster_columns table. … … 445 445 '''3.1.3 - Storing in-db raster or registering out-db raster?''' 446 446 447 One of the major PostGIS WKTRaster features is the ability to store raster data in the database or merely register them as external files residing in the filesystem. When registering a raster, only the raster metadata are stored in the database (width, height, number of band, georeference and path to the actual raster file), not the values associated with the pixels. Registering is done via the loader’s –R option.447 One of the major PostGIS Raster features is the ability to store raster data in the database or merely register them as external files residing in the filesystem. When registering a raster, only the raster metadata are stored in the database (width, height, number of band, georeference and path to the actual raster file), not the values associated with the pixels. Registering is done via the loader’s –R option. 448 448 {{{ 449 449 >gdal2wktraster.py –r c:/imagesets/landsat/image01.tif –t landsat -R … … 484 484 [[BR]] 485 485 486 = '''5 - PostGIS WKTRaster Reference''' =486 = '''5 - PostGIS Raster Reference''' = 487 487 488 488