
AWS S3, Google Cloud Storage).Įfficient use of cloud stored rasters requires the use of a "cloud optimized" format. The raster2pgsql tool uses GDAL to access raster data, and can take advantage of a key GDAL feature: the ability to readįrom rasters that are stored remotely in cloud "object stores" (e.g. Note the use of ST_ConvexHull since most raster operators are based on the convex hull of the rasters. 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) ) For example you can create a raster table in a different projection from an existing one using ST_Transform There are even many more options for creating new raster tables from existing tables. Other functions such as ST_Union or ST_MapAlgebraFct or any of the family of other map algebra functions.

To achieve that you'll want to use ST_AsRaster perhaps accompanied with You can also create rasters from geometries. ST_MakeEmptyRaster, followed by ST_AddBand If you are creating rasters not as a derivative of other rasters, you will want to start with: There are many functions to help with that goal.
#RASTER DATA FORMAT SERIAL#
grc/.tabĬreate 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) Ground-based SAR Applications Testbed File Format (.gff)ĬOSAR Annotated Binary Matrix (TerraSAR-X) JAXA PALSAR Product Reader (Level 1.1/1.5) The -G commands outputs a list something like raster2pgsql -I -C -e -Y -F -s 26986 -t 128x128 -l 2,4 bostonaerials2008/*.jpg aerials.boston | psql -U postgres -d gisdb -h localhost -p 5432 -get a list of raster types supported: (-F) Include a field called filename to hold the name of the file the tiles were cut from. Break up the rasters into 128x128 pixel tiles and apply raster constraints.
#RASTER DATA FORMAT FULL#
Into a schema called aerial and create a full view, 2 and 4 level overview tables, use copy mode for inserting (no intermediary file just straight to db), and -e don't force everything in a transaction (good if you want to see data in tables right away without waiting). Load rasters Massachusetts state plane meters aerial tiles Raster2pgsql -s 4326 -I -C -M *.tif -F -t 100x100 melevation > elev.sqlĪ conversion and upload can be done all in one step using UNIX pipes: raster2pgsql -s 4326 -I -C -M *.tif -F -t 100x100 melevation | psql -d gisdb The raster table will be created in the default schema of the database or user You can leave the schema name out e.g demelevation instead of melevation and Only 0 is supported at this time.Īn example session using the loader to create an input file and uploading it chunked in 100x100 tiles might look like this: E ENDIANĬontrol endianness of generated binary output of raster specify 0 for XDR and 1 for NDR (default) only NDR output is supported now -V version Optionally specify max_rows_per_copy Įxecute each statement individually, do not use a transaction. Use copy statements instead of insert statements. This applies to the primary key and the spatial index if the Specify the tablespace for the table's new index. The default tablespace unless the -X flag is also used. Note that indices (including the primary key) will still use Specify the tablespace for the new table. Note you save time in checking, but could end up with far more junk rows in your database and those junk rows are not marked as empty tiles. Keeps empty tiles and skips NODATA value checks for each raster band. IĬreate a GiST index on the raster column. Specify name of destination raster column, default is 'rast'Īdd a column with the name of the file -n COLUMN Optional parameters used to manipulate database objects NODATA value to use on bands without a NODATA value. Note that your generated sql file will contain both the main table and overview tables. Stored in the database and is not affected by -R. The pattern o_ overview factor_ table, where overview factor is a placeholder for numerical overview factor and table is replaced with the base table name. l OVERVIEW_FACTORĬreate overview of the raster. Only the metadata of the raster and path location to the raster is stored in the database (not the pixels).

Register the raster as a filesystem (out-db) raster. Pad right-most and bottom-most tiles to guarantee that all tiles TILE_SIZE is expressed as WIDTHxHEIGHT or set to the value "auto" to allow the loader to compute an appropriate tile size using the first raster and applied to all rasters. If unspecified,Ĭut raster into tiles to be inserted one per table row. For more than one band index, separate with comma (,). Index (1-based) of band to extract from raster. If not provided or is zero, raster's metadata will be checked to determine an appropriate SRID. Assign output raster with specified SRID.
