[postgis-users] Why do I get this notice : "attempting to get pixel value with out of range raster coordinates" ?

Hugues François hugues.francois at irstea.fr
Wed Jul 10 03:53:09 PDT 2013


Hello,

This does not seem to be a very serious problem but I don't understand why it raises, and since I don't understand, I may make a mistake somewhere.

I thought this couldn't happen since I have added an intersects statement. In the example below the range raster coordinates shows a negative value (how is it possible ?) but the same notice raise with all positive values, theoretically within range raster coordinates ((85,100) for 100x100 tiles).

If I look at tiles' envelopes and pixels' geometries within these tiles I have no holes and all raster's constraint were added (pixels are aligned, etc...)

What information should I give for you to be able to help me ?
- this query runs within a plpgsql loop to test neighbors values of a pixel (within a loop to test previously selected points' neighbors)
- I tried (unsuccessfully) to test point to be within the extent of the raster or to exclude null values (but still with st_value())
- I run it with postgresql 9.2 / postgis 2.0.3

Thanks in advance for any explanation,
Regards,

Hugues.

NOTICE:  Attempting to get pixel value with out of range raster coordinates: (72, -1)
CONTEXT:  PL/pgSQL function st_value(raster,integer,geometry,boolean) line 13 at RETURN
SQL statement "


SELECT
ind, id_rm,
st_value(a.rast,st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154)) alt,
st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154) point_geom, 17 i,
ST_PixelAsPolygon(a.rast, ST_World2RasterCoordX(a.rast, st_x(point_geom)+4.0681885896661), ST_World2RasterCoordY(a.rast, st_y(point_geom)-4.0681885896661)) pix_geom

FROM rasters.dsa_5m_points_dsc c, rasters.mnt_2154 a, rasters.slopes_2154 b, pix_union

WHERE i = 17-1
AND st_intersects(a.rast, st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154))
AND st_value(a.rast,st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154)) < alt
AND st_value(a.rast,st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154)) >= 1330
AND NOT st_intersects(ST_PixelAsPolygon(a.rast, ST_World2RasterCoordX(a.rast, st_x(point_geom)+4.0681885896661), ST_World2RasterCoordY(a.rast, st_y(point_geom)-4.0681885896661)), pix_union)
AND st_intersects(b.rast, st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154))
AND st_value(b.rast, st_setsrid(st_makepoint(st_x(point_geom)+4.0681885896661, st_y(point_geom)-4.0681885896661),2154)) < 40


More information about the postgis-users mailing list