[postgis-users] st_aspng and blob image

Bborie Park bkpark at ucdavis.edu
Fri Jun 22 09:01:42 PDT 2012


I can't comment specifically about the imagecreatefromstring()
function but you could try the code provided at:

http://www.bostongis.com/blog/index.php?/archives/175-Minimalist-Web-based-PHP-PostGIS-2.0-Spatial-GaeometryRaster-Viewer.html

-bborie

On Fri, Jun 22, 2012 at 8:06 AM, Francesco Geri <francescogeri at yahoo.it> wrote:
> 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
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkpark at ucdavis.edu



More information about the postgis-users mailing list