[postgis-users] Trouble generating raster image with fixed dimensions

Carlo Fragni carlo.fragni at webradar.com
Fri Feb 12 12:32:19 PST 2016

Hello everyone,

I am trying to create fixed dimensions squared png tiles with raster data,
but i am getting cropped irregular tiles with varying height and width
depending on the values of the pixels. I tried a couple of things to work
around this issue, like creating a squared raster and merging it with the
cropped one but I can't manage to merge rasters of different dimensions.
Can anyone give me a hand? Is there a better way to force the output image
not to crop the parts of the squared area with no data?

This query illustrates my issue:

select st_summary(ST_UNION(r))
from (

 select st_union(ST_Clip(rast,1,g::geometry,TRUE)) as r
  st_makebox2d(st_makepoint(0,0),st_makepoint(10,10)) as g,

  (select ST_AsRaster(p,1, 1, '2BUI') as rast
  from (
   select st_makepoint(5,2) as p union
   select st_makepoint(3,4)
  ) as rast
  ) as r
1, '2BUI')

) as t

Any help is deeply appreciated.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160212/aa2a2f04/attachment.html>

More information about the postgis-users mailing list