Ahh, forgive stupid question:

ST_Rescale flipped the sign of my y pixel size. Changing to 
ST_Rescale(rast_750, 375,-375) makes everything ducky.

Bryce

From: postgis-users [mailto:postgis-users-boun...@lists.osgeo.org] On Behalf Of 
Nordgren, Bryce L -FS
Sent: Thursday, March 10, 2016 12:00 PM
To: PostGIS Users Discussion (postgis-users@lists.osgeo.org) 
<postgis-users@lists.osgeo.org>
Subject: [postgis-users] 2 raster map algebra returning all zeros

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.
_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to