Import Raster to PostgreSQL/PostGIS and View in QGIS

Table of Contents

raster2pgsql -I -C -s <SRID> <PATH/TO/RASTER FILE> <SCHEMA>.<DBTABLE> | psql -d <DATABASE>

The command parameters are:

  • <SRID>—Spatial reference identifier
  • <PATH/TO/RASTER FILE>—Full path to the raster file (such as C:\MyData\land\landuse.tif)
  • <SCHEMA>—Target schema where the new raster table will be created
  • <DBTABLE>—New database table to be created (usually the same name as the source raster file)
  • <DATABASE>—Target database where the table will be created

The following example uses raster2pgsql to create an input file and upload it into 100x100 tiles. The -I option will create a spatial GiST index on the raster column after the table is created. This is strongly recommended for improved performance. The -C option will apply the raster constraints (SRID, pixel size and so on) to ensure the new raster table is correctly registered in the raster_columns view.

raster2pgsql -s 4236 -I -C -M *.tif -F -t 100x100 public.demelevation | psql -d gisdb

Mình đã thử và Ok

raster2pgsql.exe -s srid -I -C -M image -F -t size schema.table | psql -d database -U Username -p Port raster2pgsql.exe -s 4326 -I -C -M t1.tif -F -t 250x250 public.t1 | psql -d test_raster -U postgres -p 5433


Warning: Undefined variable $comments_number in /shared/webdir2/ on line 35

Warning: Undefined variable $comments_number in /shared/webdir2/ on line 39
0 thoughts on “Import Raster to PostgreSQL/PostGIS and View in QGIS”

Leave a Reply

Your email address will not be published. Required fields are marked *