Ticket #1537 (closed defect: fixed)
[raster] Impossible to set the nodata value of a raster returned by ST_Intersection(raster, geometry, extenttype)
| Reported by: | pracine | Owned by: | pracine |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS 2.0.0 |
| Component: | raster | Version: | trunk |
| Keywords: | Cc: |
Description
This is a strange bug.
The first query shows the pixel type of the first band of the result of a ST_Intersection(raster, geometry, extent) operation:
SELECT ST_BandPixelType(
ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
'SECOND'), 1);
The pixel type is '8BSI' so I should be able to reset the nodata value of the resulting raster to whatever between -128 and 127 (say -3) but I can't set it to something smaller than 0:
SELECT ST_BandNodataValue(
ST_SetBandNodataValue(
ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
'SECOND'), -3));
If I try to set it to something greater than -1 it works:
SELECT ST_BandNodataValue(
ST_SetBandNodataValue(
ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
'SECOND'), 15))
and if I set the extent of the result of the intersection to 'FIRST' I can do what I want:
SELECT ST_BandNodataValue(
ST_SetBandNodataValue(
ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
'FIRST'), -15))
There might be something I don't get here...
Change History
Note: See
TracTickets for help on using
tickets.
