[postgis-devel] ST_Value should return NULL for nodata values

Etienne Bellemare etiennebr at gmail.com
Fri Dec 17 12:51:07 PST 2010


Hi all,

I've been experimenting with PostGIS raster lately and I'd like to comment
on st_value() from my experience working with it lastly. Overall, I'd like
to say It has been pretty useful to me.

In Ticket 606 <http://trac.osgeo.org/postgis/ticket/606> there a suggestion
that either :

> *1) Nodata values are REAL nodata values and there is NO value, period. In
> this case ST_Value should return NULL.
> 2) We want to be able to do computation with nodata values. In this case
> ST_Value should return the nodata value.
> Up to now I have a strong preference for 2) and plan to change the behavior
> of ST_Value. Still thinking about the impacts though...*
>

I'd like to vote for option 1. Always return NULL (and even store NULL in
the table). No data is... having no data. If you are in a database this is
represented by NULL value. It is not -9999 or any other value that are used
to represent NULL outside the db, like in a raster file. If you want a
value, you should compute it. If you need to know if you are in the range of
the raster, I guess you should do it using box() or something like that.

Returning the "true value" of no data is bringing complexity and require
more management from the user. Let's say I'm merging two files in a raster
layer in PostGIS... they could have two different ways of representing no
data: PostGIS raster should stick to NULL. It the more sensible way of doing
it in my opinion.

Other thing is, there's a Warning raised if the value asked is outside the
raster.

> WARNING:  Attempting to get pixel value with out of range raster
> coordinates
> CONTEXT:  PL/pgSQL function "st_value" line 12 at RETURN
>
I'm really not sure this message is appropriate. I think it should only
return NULL value, that's it. we are in a place where there is no value then
return NULL. the thing is when you compute the value of a raster for 1
billion points (my experience), you get a few outside the raster. This is
flooding my console with, finally, not really interesting information. I
don't learn anything there that I couldn't learn from looking at the output.

I'm open to other arguments, I just felt like I could bring my experience as
the thing is pretty young... and promising.

Etienne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20101217/46b9cdf0/attachment.html>


More information about the postgis-devel mailing list