5

I have imported a raster into PostGIS, and would like to know the "byte type," ie. if the orignal GeoTIFF was a Byte type or Int16.

Is this possible to do after importing to PostGIS? If so, how? Or must it be done on the GeoTIFF file itself?

2 Answers 2

4

Under your public schema you should have a raster_columns view which serves as a catalogue for all raster columns in your database. One of the columns in the view is pixel_types which lists the pixel type for each band.

If you used the raster2pgsql utility these details should be updated automatically. Otherwise you may have to run the AddRasterConstraints function.

To access via SQL query:

SELECT * FROM raster_columns;

or, for a specific table:

SELECT * FROM raster_columns
WHERE r_table_schema = 'name_of_the_schema_your_table_is_in'
    and r_table_name = 'name_of_your_raster_table';
2
  • Thanks! Do you know how to access this with a SELECT command?
    – knutole
    Feb 10, 2017 at 14:04
  • 1
    I've updated my answer to include an SQL query example.
    – Ali
    Feb 10, 2017 at 14:08
1

Did you try:

SELECT ST_BandPixelType(rast)
FROM yourrastertable

http://postgis.net/docs/RT_ST_BandPixelType.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.