rt_asgdalraster.sql 3.56 KB
Newer Older
1 2 3 4
WITH foo AS (
	SELECT postgis_raster_lib_version()
)
SELECT NULL FROM foo;
5
SET postgis.gdal_enabled_drivers = 'GTiff PNG JPEG';
6 7 8 9 10 11 12 13 14 15
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
			NULL,
			'GTiff'
		)
	) > 0
		THEN 1
	ELSE 0
END;
16 17 18
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
19
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '64BF', 123.4567, NULL),
20 21 22 23 24 25 26 27 28
			'GTiff'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
29 30
			ST_AddBand(
				ST_AddBand(
31
					ST_AddBand(
32
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
33 34 35
						, 1, '64BF', 1234.5678, NULL
					)
					, '64BF', 987.654321, NULL
36
				)
37 38 39 40 41 42 43 44 45 46 47
				, '64BF', 9876.54321, NULL
			),
			'GTiff'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
48 49
			ST_AddBand(
				ST_AddBand(
50
					ST_AddBand(
51
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
52 53 54
						, 1, '64BF', 1234.5678, -9999
					)
					, '64BF', 987.654321, -9999
55
				)
56 57 58 59 60 61 62 63 64 65 66
				, '64BF', 9876.54321, -9999
			),
			'GTiff'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
67
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BSI', 123, NULL),
68 69 70 71 72 73 74 75 76
			'PNG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
77
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BUI', 123, NULL),
78 79 80 81 82 83 84 85 86
			'PNG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
87
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BSI', -123, NULL),
88 89 90 91 92 93 94 95 96
			'PNG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
97
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BUI', 254, NULL),
98 99 100 101 102 103 104 105 106
			'PNG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
107 108
			ST_AddBand(
				ST_AddBand(
109
					ST_AddBand(
110
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
111 112 113
						, 1, '8BSI', 1, -1
					)
					, 2, '8BSI', 11, -1
114
				)
115 116 117 118 119 120 121 122 123 124 125 126
				, 3, '8BSI', 111, -1
			),
			'PNG',
			ARRAY['ZLEVEL=1']
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
127 128
			ST_AddBand(
				ST_AddBand(
129
					ST_AddBand(
130
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
131 132 133
						, 1, '8BSI', 1, -1
					)
					, 2, '8BSI', 11, -1
134
				)
135 136 137 138 139 140 141 142 143 144 145 146
				, 3, '8BSI', 111, -1
			),
			'PNG',
			ARRAY['ZLEVEL=9']
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
147
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BSI', 123, NULL),
148 149 150 151 152 153 154 155 156
			'JPEG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
157
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BUI', 123, NULL),
158 159 160 161 162 163 164 165 166
			'JPEG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
167
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BSI', -123, NULL),
168 169 170 171 172 173 174 175 176
			'JPEG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
177
			ST_AddBand(ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0), 1, '8BUI', 254, NULL),
178 179 180 181 182 183 184 185 186
			'JPEG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
187 188
			ST_AddBand(
				ST_AddBand(
189
					ST_AddBand(
190
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
191 192 193
						, 1, '8BSI', 1, -1
					)
					, 2, '8BSI', 11, -1
194
				)
195 196 197 198 199 200 201 202 203 204 205
				, 3, '8BSI', 111, -1
			),
			'JPEG'
		)
	) > 0
		THEN 1
	ELSE 0
END;
SELECT CASE
	WHEN length(
		ST_AsGDALRaster(
206 207
			ST_AddBand(
				ST_AddBand(
208
					ST_AddBand(
209
						ST_MakeEmptyRaster(200, 200, 10, 10, 2, 2, 0, 0)
210 211 212
						, 1, '8BSI', 1, -1
					)
					, 2, '8BSI', 11, -1
213
				)
214 215 216 217 218 219 220 221 222
				, 3, '8BSI', 111, -1
			),
			'JPEG',
			ARRAY['QUALITY=90','PROGRESSIVE=ON']
		)
	) > 0
		THEN 1
	ELSE 0
END;