[postgis-users] 2 raster map algebra returning all zeros
Nordgren, Bryce L -FS
bnordgren at fs.fed.us
Thu Mar 10 15:17:29 PST 2016
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.
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Nordgren, Bryce L -FS
Sent: Thursday, March 10, 2016 12:00 PM
To: PostGIS Users Discussion (postgis-users at lists.osgeo.org) <postgis-users at 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_Rescale(rast_750, 375.), 1,
'8BUI', 'FIRST'),3.),1.) as test
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?
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...
More information about the postgis-users