Created
August 1, 2014 05:10
-
-
Save demiurg/52c67af2fedde2c7787b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH empty AS( | |
| SELECT ST_MakeEmptyRaster(256, 256, -5205055.878107, 7905423.213366, 9783.939620) as alignto | |
| ) SELECT ST_AsGDALRaster( | |
| ST_Transform(ma3, alignto), 'PNG' | |
| ) as tiffvals, | |
| FROM ( | |
| SELECT ST_MapAlgebra( | |
| isUnion, | |
| ma2, | |
| '(CASE WHEN [rast1] <= 10 and [rast2] = 101 THEN 101 ELSE 100 END::int)' | |
| ) as ma3 | |
| FROM ( | |
| SELECT ST_Union(isClip) as isUnion | |
| FROM ( | |
| SELECT ST_Clip(a.rast, ST_GeomFromEWKT('SRID=3857;POLYGON(-5205055.87811 7895639.27375, -5205055.87811 7905423.21337, -5195271.93849 7905423.21337, -5195271.93849 7895639.27375, -5205055.87811 7895639.27375)')) as isClip | |
| FROM cdesign.imp_sur_06_resampled a WHERE (a.rid = '992' or a.rid = '993' or a.rid = '1045' or a.rid = '1046') | |
| ) as foo8 | |
| ) as foo9, ( | |
| SELECT ST_MapAlgebra( | |
| elUnion, | |
| ma1, | |
| '(CASE WHEN [rast1] >= 30 and [rast2] = 101 THEN 101 ELSE 100 END::int)' | |
| ) as ma2 | |
| FROM ( | |
| SELECT ST_Union(elClip) as elUnion | |
| FROM ( | |
| SELECT ST_Clip(a.rast, ST_GeomFromEWKT('SRID=3857;POLYGON(-5205055.87811 7895639.27375, -5205055.87811 7905423.21337, -5195271.93849 7905423.21337, -5195271.93849 7895639.27375, -5205055.87811 7895639.27375)')) as elClip | |
| FROM cdesign.ned_10_resampled a WHERE (a.rid = '992' or a.rid = '993' or a.rid = '1045' or a.rid = '1046') | |
| ) as foo6 | |
| ) as foo7, ( | |
| SELECT ST_MapAlgebra( | |
| sgUnion, | |
| ccUnion, | |
| '(CASE WHEN [rast1] >= 1204.0 and [rast2] <= 70 THEN 101 ELSE 100 END::int)' | |
| ) as ma1 | |
| FROM ( | |
| SELECT ST_Union(sgClip) as sgUnion | |
| FROM ( | |
| SELECT ST_Clip(a.rast,ST_GeomFromEWKT('SRID=3857;POLYGON(-5205055.87811 7895639.27375, -5205055.87811 7905423.21337, -5195271.93849 7905423.21337, -5195271.93849 7895639.27375, -5205055.87811 7895639.27375)')) as sgClip | |
| FROM cdesign.solar_gain_cor_resampled a WHERE (a.rid = '992' or a.rid = '993' or a.rid = '1045' or a.rid = '1046') | |
| ) as foo | |
| ) as foo2, ( | |
| SELECT ST_Union(ccClip) as ccUnion | |
| FROM ( | |
| SELECT ST_Clip(a.rast,ST_GeomFromEWKT('SRID=3857;POLYGON(-5205055.87811 7895639.27375, -5205055.87811 7905423.21337, -5195271.93849 7905423.21337, -5195271.93849 7895639.27375, -5205055.87811 7895639.27375)')) as ccClip | |
| FROM cdesign.can_cov_01 a WHERE (a.rid = '992' or a.rid = '993' or a.rid = '1045' or a.rid = '1046') | |
| ) as foo3 | |
| ) as foo4 | |
| ) as foo5 | |
| ) as foo10 | |
| ) as foo11 ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment