[postgis-users] 2 raster map algebra returning all zeros

Nordgren, Bryce L -FS bnordgren at fs.fed.us
Thu Mar 10 10:59:48 PST 2016


I have a table with two raster columns, which I'm trying to combine into a third column using the two raster MapAlgebra. The columns represent fire events at different resolutions, which fortuitously are a simple factor of two different. These are all 8BUI rasters interpreted  as Boolean masks (0==False,1==True). The third column will eventually represent a logical OR of the two masks, at the higher resolution. Each row covers exactly the same extent at the different resolutions. Trying an expression which should simply copy from one raster into the result, I get:

select rid, ST_ValueCount(rast_375,1.) as r375,
            ST_ValueCount(ST_Rescale(rast_750, 375.), 1.) as r750,
            ST_ValueCount(ST_SetBandNoDataValue(ST_MapAlgebra(
                             rast_375, 1,
                             ST_Rescale(rast_750, 375.), 1,
                             '[rast2]',
                             '8BUI', 'FIRST'),3.),1.) as test
from "Run_0000".fire_events_raster
WHERE rast_375 is not null and rast_750 is not null ORDER BY r375 DESC;

rid  | r375 | r750 | test
------+------+------+------
  166 | 2448 | 1708 |    0
  216 | 1044 | 1020 |    0
  916 | 1039 | 2068 |    0
...

Running ST_SameAlignment() on the input rasters returns true across the board. They have the same upperleft corner. SRIDS are identical (96630;  http://spatialreference.org/ref/sr-org/6630/) If I use either input raster as both the first and second raster to MapAlgebra, I get output.

Any ideas what could be throwing MapAlgebra off?

Thanks,
Bryce




This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160310/fbcc064e/attachment.html>


More information about the postgis-users mailing list