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

Tom van Tilburg tom.van.tilburg at gmail.com
Sat Feb 13 08:49:43 PST 2016


Carlo,

Your query seems a bit complicated and I'm not sure what you are trying to
do in it. Maybe you could simplify it a bit? Or at least give a real world
example of what you are trying to do?  For sure try to set a projection
(SRID) to your geometries before turning them into rasters.

Best,
 Tom

On Fri, 12 Feb 2016 at 21:32 Carlo Fragni <carlo.fragni at webradar.com> wrote:

> 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
>  from
>   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
>  union
>  select
> ST_AsRaster(st_makebox2d(st_makepoint(0,0),st_makepoint(10,10))::geometry,1,
> 1, '2BUI')
>
> ) as t
>
> Any help is deeply appreciated.
>
> Best regards,
>  Carlo
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160213/4d0e63a5/attachment.html>


More information about the postgis-users mailing list