I've got a raster loaded into PostGIS that contains grib forecast data which I loaded using raster2pgsql using SRID 4326. To keep things simple I am not tiling the raster so I only have one row in my table. After the import, the resulting table contains two columns: rid (integer) and rast (raster).

The source grib contain data for two points of time, and covers 9 different altitudes. I'm storing two data points for each time and altitude so I've got a total of 36 bands.

How can I query this raster to get a rowset with useful column names containing all available numeric values available for a path over the ground (geometry linestring) over time?

Here's CREATE TABLE for the table that results from running raster2pgsql:

CREATE TABLE public.cat
    rid integer NOT NULL DEFAULT nextval('cat_rid_seq'::regclass),
    rast raster,
    CONSTRAINT cat_pkey PRIMARY KEY (rid)

And I can see I have 36 bands when I run this SQL:

SELECT ST_NumBands(rast) As num_bands
FROM public.cat;
  • GIS SE has a policy of "One question per Question". Please edit the question to focus on your most pressing issue; you can always ask other questions later. Also, please take the Tour.
    – Vince
    Feb 5 '17 at 19:58
  • What have you tried so far? SQL questions should have SQL code in them. If you at least start, we'll know the table names and spatial column names.
    – Vince
    Feb 5 '17 at 20:45
  • Spatial column name provided in the first paragraph. Here's CREATE TABLE statement if that helps. CREATE TABLE public.cat ( rid integer, rast raster ) I don't know where to begin with how to query a raster, hoping someone here on GIS can assist.
    – boozedog
    Feb 5 '17 at 20:48
  • I can see there are 36 bands when I run the following SQL: SELECT ST_NumBands(rast) As num_bands FROM public.cat;
    – boozedog
    Feb 5 '17 at 20:52
  • 1
    Please edit the question to improve it. As per the Tour, comments are used to request clarifications, and clarifications should be made as edits. It's not fair to those who would help you to need to sift though comments to find critical information. SQL code is a requirement for SQL questions to be on-topic here.
    – Vince
    Feb 5 '17 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.