Using ST_AsRaster function got a abnormal result

tlgeo george georgetlgeo at gmail.com
Mon May 20 19:34:00 PDT 2024


Hello folks,

When I use ST_AsRaster in Postgis, I can't get the expected result.

My SQL: SELECT ST_AsPNG(ST_AsRaster(ST_GeomFromText('POLYGON((4 3,4 2,1 2,1
3,4 3))'),150, 150,ARRAY['8BUI'],ARRAY[4],ARRAY[0])) ;

I write the select result into byte[] and write into disk tiff file in Java.

But I got a file like this:

[image: image.png]

This result file is in the attached file.

I think the right result should contain nodata district ,but my result file
did't.

Any clues will appreciate,thank you very much.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240521/2644a7d9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 2620 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240521/2644a7d9/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cb12840d-f845-4c4d-8234-5827eedd2710.tiff
Type: image/tiff
Size: 234 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240521/2644a7d9/attachment.tiff>


More information about the postgis-users mailing list