[postgis-users] st_aspng and blob image
Francesco Geri
francescogeri at yahoo.it
Fri Jun 22 08:06:32 PDT 2012
Hello everybody.
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.
Following the example in the postgis documentation:
SELECT ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),150, 150, '2BUI'));
this generate a binary sequence (blob) but when I try to view it in
a web browser I obtain the follow error message
Warning: imagecreatefromstring() [function.imagecreatefromstring]: Data is not in a recognized format
This is my script:
header('Content-Type: image/png');
$query_finale="SELECT
ST_AsPNG(ST_AsRaster(ST_Buffer(ST_Point(1,5),10),10, 10, '2BUI'));"
$finale_result_raster=pg_query($conn,$query_finale);
$final_result= pg_query($conn,$query_finale);
$img_raster=pg_fetch_array($final_result);
$immagine=$img_raster['immagine'];
imagepng($immagine);
does anyone know why it doesn't work?
Thanks!!!
Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120622/c19cee82/attachment.html>
More information about the postgis-users
mailing list