<html><head></head><body><div class="ydp54b6da99yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;">Is it possible to add a PostGIS raster layer to a project using PyQGIS?<span class="ydpfbc82a13Apple-converted-space"> </span></span><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;">The PyQGIS Developer Cookbook mentions adding rasters from files, geopackages and WCS services.<span class="ydpfbc82a13Apple-converted-space"> </span></span><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;">If I try using a QgsDataSourceUri by feeding it a raster column instead of a geometry column, the PostGIS error that is generated shows that is not going to work because raster is not a geometry:<span class="ydpfbc82a13Apple-converted-space"> </span></span><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"> <span class="ydpfbc82a13Apple-converted-space"> </span></span><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;">WARNING    Erroneous query: SELECT 0, array_agg(DISTINCT st_srid("rast")::text || ':' || UPPER(geometrytype("rast"))) FROM "public"."indicators__g_economic_rebal_r_62ft" returned 7 [ERROR: function geometrytype(raster) does not exist<span class="ydpfbc82a13Apple-converted-space"> </span></span><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><br style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;">Any ideas of what I can do? Is the best course of action to make it into a webservice <span><span style="color: rgb(0, 0, 0); font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; font-size: 13.44px;"> first </span></span>using QGIS Server or Geoserver?<span class="ydpfbc82a13Apple-converted-space"> </span></span></div><br></div><div dir="ltr" data-setdir="false">-Thayer</div><div dir="ltr" data-setdir="false"><br></div></div></body></html>