From 62c10a991e664bb3ae7d22d960dbefe681117b9e Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Fri, 16 Dec 2011 01:41:59 +0000 Subject: [PATCH] start best practices stuff and break up loading and creating into two separate sections. git-svn-id: http://svn.osgeo.org/postgis/trunk@8438 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/using_raster_dataman.xml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/using_raster_dataman.xml b/doc/using_raster_dataman.xml index 886d89f6f..cdf829f5e 100644 --- a/doc/using_raster_dataman.xml +++ b/doc/using_raster_dataman.xml @@ -5,6 +5,8 @@ Loading and Creating Rasters For most use cases, you will create PostGIS rasters by loading existing raster files using the packaged raster2pgsql raster loader. + + Using raster2pgsql to load rasters The raster2pgsql is a raster loader executable that loads GDAL supported raster formats into sql suitable for loading into a PostGIS raster table. It is capable of loading folders of raster files as well as creating overviews of rasters. @@ -221,6 +223,27 @@ psql -d gisdb -f elev.sql into a schema called aerial and create a full view, 2 and 4 level overview tables and directly insert to database. Break up the rasters into 100x100 pixel tiles and apply raster constraints. Use copy mode instead of table insert. (-F) Include a field called filename to hold the name of the file the tiles were cut from. raster2pgsql -I -C -Y -F -s 26986 -t 100x100 -l 2,4 bostonaerials2008\*.jpg aerials.boston | psql -U postgres -d gisdb -h localhost -p 5432 + + + Creating rasters using PostGIS raster functions + On many occasions, you'll want to create rasters and raster tables right in the database. There are a plethora of functions to do that. The general steps to follow. + + Create a table with a raster column to hold the new raster records which can be accomplished with: + CREATE TABLE myrasters(rid serial primary key, rast raster); + + + There are many functions to help with that goal. If you are creaeting rasters not as a derivative of other rasters, you will want to start with: + , followed by + You can also create rasters from geometries. To achieve that you'll want to use perhaps accompanied with + other functions such as + + Once you are done populating your table initially, you'll want to create a spatial index on the raster column with something like: + CREATE INDEX myrasters_rast_st_convexhull_idx ON myrasters USING gist( ST_ConvexHull(rast) ); + Note the use of since most raster operators are based on the convex hull of the rasters. + Pre-2.0 versions of PostGIS raster were based on the envelop rather than the convex hull. For teh spatial idnexes to work properly you'll need to drop those and replace with convex hull based index. + Apply raster constraints using + + Raster Catalogs @@ -303,7 +326,7 @@ psql -d gisdb -f elev.sql The raster_overviews catalog contains the following columns of information. - o_table_catalog The database the overview table is in. This will always reads the current database. + o_table_catalog The database the overview table is in. This will always read the current database. o_table_schema The database schema the overview raster table belongs to. -- 2.40.0