<div dir="ltr"><div>I'm afraid the only way to visualyze raster fast enough in GQIs I found is to export the raster as tif :-(<br></div><div>Of course using gdal is not an option because it is very slow, <br>so I use the Pierre Racine trick with plpythonu (I lost the source but all credits to him of course).<br>
</div><div>This is order of magnitude faster.<br></div>Cheers,<br>Rémi-C<br><br>----------------------------------------<br> CREATE OR REPLACE FUNCTION write_file (param_bytes bytea, param_filepath text, chmod character varying (4))<br>
RETURNS text<br>AS $$<br>import os<br>f = open(param_filepath, 'wb')<br>chmod_oct = int(chmod,8) # new addition (converts chmod octal code to associated integer value)<br>os.chmod(param_filepath,chmod_oct) # new addition (changes read/write permissions)<br>
f.write(param_bytes)<br>f.close() # new addition (ensures file is closed after writing)<br>return param_filepath<br>$$ LANGUAGE plpythonu;<br><br>DROP FUNCTION IF EXISTS write_file_texte (param_bytes bytea, param_filepath text, chmod character varying (4));<br>
 CREATE OR REPLACE FUNCTION write_file_texte (param_bytes text, param_filepath text, chmod character varying (4))<br>RETURNS text<br>AS $$<br>import os<br>f = open(param_filepath, 'w')<br>chmod_oct = int(chmod,8) # new addition (converts chmod octal code to associated integer value)<br>
os.chmod(param_filepath,chmod_oct) # new addition (changes read/write permissions)<br>f.write(param_bytes)<br>f.close() # new addition (ensures file is closed after writing)<br>return param_filepath<br>$$ LANGUAGE plpythonu;<br>
<br><br>--Here’s an example of how to use this function:<br><br>SELECT write_file(ST_AsTIFF(ST_SetSRID(ST_Transform(rast,931008),931008)), '/tmp/rast_' || rid || '.tif','777')<br>FROM test_raster.temp_test_interpolation ;<br>
 <br>----------------------------------------<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-20 11:29 GMT+02:00 dandrigo <span dir="ltr"><<a href="mailto:lcelati@latitude-geosystems.com" target="_blank">lcelati@latitude-geosystems.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's ok. Thanks. I succeed in displaying pg raster via qgis. in order to<br>
display pg raster data, you're obliged to specified the host value.<br>
<br>
Remi, indeed, the displaying is slow. According to you, it would be usefull<br>
to import raster with -t option (tiles) in order to speed up the displaying?<br>
<br>
With qgis 2.2, the gdal version is 10.1.<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://postgis.17.x6.nabble.com/Problem-with-postgis-raster-tp5006344p5006363.html" target="_blank">http://postgis.17.x6.nabble.com/Problem-with-postgis-raster-tp5006344p5006363.html</a><br>

<div class="HOEnZb"><div class="h5">Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>