1

I need to update tiled raster data from the "whole image". I have created this query:

UPDATE data_tiled AS t  SET raw_data = f.raw_data  
FROM 
( 
SELECT data_time, data_type, ST_Tile(raw_data, 250, 250) As raw_data  
FROM data_full 
WHERE data_time = '2015-12-06 00:00:00' AND data_type = 'a' 
) as f 
WHERE t.data_time = f.data_time AND t.data_type = f.data_type;

but this will result in one tile copied to every row. For example, source is tiled to 18 rasters, 18 rows is updated, but every row has the same content. I need it to be each row its own tile.

0

I have done it this way:

UPDATE data_tiled t 
SET raw_data = f.raw_data_tile
FROM 
( 
  SELECT data_time, data_type, ST_Tile(raw_data, 250, 250) As raw_data_tile  
  FROM data_full  
  WHERE data_time = '2015-12-06 00:00:00' AND data_type = 'a' 
) as f 
WHERE t.data_time = f.data_time 
AND t.data_type = f.data_type
AND ST_UpperLeftX(t.raw_data) = ST_UpperLeftX(f.raw_data_tile)
AND ST_UpperLeftY(t.raw_data) = ST_UpperLeftY(f.raw_data_tile)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.