<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello everybody.<br>
I have some problems with st_aspng and st_asraster. I would try to
generate a raster image from a vector polygon and view this with a
php script. <br>
Following the example in the postgis documentation:<br>
<br>
<pre class="programlisting">SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150, 150, '2BUI'));</pre>
<br>
this generate a binary sequence (blob) but when I try to view it in
a web browser I obtain the follow error message<br>
<br>
<b>Warning</b>: imagecreatefromstring() [<a href="http://www.sistema-studio.it/demo_webgis/function.imagecreatefromstring">function.imagecreatefromstring</a>]:
Data is not in a recognized format<br>
<br>
This is my script:<br>
<br>
header('Content-Type: image/png');<br>
$query_finale="SELECT
ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),10, 10, '2BUI'));"<br>
$finale_result_raster=pg_query($conn,$query_finale);<br>
$final_result= pg_query($conn,$query_finale);<br>
$img_raster=pg_fetch_array($final_result);<br>
$immagine=$img_raster['immagine'];<br>
imagepng($immagine);<br>
<br>
does anyone know why it doesn't work?<br>
<br>
Thanks!!!<br>
<br>
Francesco</div></div></body></html>