Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm fiddling around trying to create a thumbnail of a fairly large (originally 27MB) raster, chunked into 64x64 blocks. I've got the following and it works, quite well, but I'm wondering if there is a way to make it more efficient, or if it is just totally mental and shouldn't be attempted.

It suffers from various flaws - that it is not really so reusable, because it is quite specific, for example.

SELECT ST_AsPNG(ST_Reclass(ST_Union(rastnxn), 1, '[0-10]:1-65535', '16BUI', 0))
        SELECT filename, ST_Resample(rast, 8, 8) as rastnxn
        FROM rasters 
        WHERE filename = 'someraster.tif'
) as subset
GROUP BY filename;

What do you think? Are there other (better) ways to quickly get the original raster back out in a 'thumbnail' style?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.