Import Raster to PostgreSQL/PostGIS and View in QGIS

Import Raster to PostgreSQL/PostGIS and View in QGIS

http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/raster2pgsql.html

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 100×100 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.

 

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 250×250 public.t1 | psql -d test_raster -U postgres -p 5433

-soiqualang_chentreu-