[postgis-users] Get ST_Value results from a tiled raster without all of the NULL results

Robin Wilson robin at rtwilson.com
Fri Jun 29 09:51:27 PDT 2012


Hi,

I'm fairly new to PostGIS and PostGIS raster stuff, so this may be a really simple question - hopefully someone will be able to help me anyway.

I am running the following SQL statement:

SELECT ST_Value(rast, ST_PointFromText('POINT(-59 -1)', 4326)) FROM modis.test

In this case, rast is the raster column in the table modis.test, which has a tiled raster dataset in it. When I run this query through psql I get a single result (4993), but when I run it through the Postgres adaptor in the programming language I'm using (node.js in this case) I get lots and lots of null results, with the one real value (4993) in the middle of them, with one row for each tile of the data.

[ { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: null },
  { st_value: 4993 },
  { st_value: null },
  { st_value: null } ]

Is there a way to stop this happening? I have tried adding a "WHERE st_value IS NOT NULL" but that doesn't seem to give any results at all. Is there a way of getting the SQL statement to treat the raster dataset like GDAL does with mode = 2 - ie. a table as one whole tiled raster not individual rasters?

Cheers,

Robin
PhD Student
University of Southampton


More information about the postgis-users mailing list