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

2012-06-29 Thread Pierre Racine
> SELECT ST_Value(rast, ST_PointFromText('POINT(-59 -1)', 4326)) FROM
> modis.test

Did you try adding:

WHERE ST_Intersects(rast, ST_PointFromText('POINT(-59 -1)', 4326))

Pierre
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


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

2012-06-29 Thread Bborie Park
Robin,

I can't say for certain but it looks like your client (not psql) is
sending off multiple queries.  The nulls would return if the point being
sampled isn't in any of the tiles.

You could enable statement logging (log_statement) in PostgreSQL to see
what statements are being run from your connector.

http://www.postgresql.org/docs/9.0/interactive/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

-bborie

On 06/29/2012 09:51 AM, Robin Wilson wrote:
> 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
> ___
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 

-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkp...@ucdavis.edu


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


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

2012-06-29 Thread Robin Wilson
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
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users