Yann, thank you for clarifying this for me. I am indeed able to add a raster in 3.12.2 using 'postgresraster' as the data provider. But I am not able to get to 'gdal' provider to work in either 3.12.2 or 3.10.5. FYI, I believe that the raster mirroring problem that I am having in 3.12 is related to the State Plane CRS that I am using (EPSG 2893). Using UTM I do not have the same problem. -Thayer
============================================= Message: 2 Date: Thu, 30 Apr 2020 23:17:05 +0200 From: Yann Voté <[email protected]> To: [email protected] Subject: Re: [Qgis-user] PyQGIS to add PostGIS raster layer? Message-ID: <[email protected]> Content-Type: text/plain; charset=utf-8; format=flowed As Alessandro pointed out, with QGS 3.12, you can use 'postgresraster' instead of 'postgres' as the providerType argument. That is: iface.addRasterLayer(uri.uri(), 'my layer label', 'postgresraster') You can find out these parameters (URI and provider type) with further introspection: when you have loaded the layer manually, select it, open a Python console, and you can get the layer Python object with: >>> db_layer = iface.activeLayer() Then you can get the source URI with: >>> db_layer.source(): and the provider type with: >>> db_layer.providerType() With these parameters you can feed iface.addRasterLayer() method or QgsRasterLayer() init method. With QGIS 3.10 you can introspect this way too to find out the URI while 'gdal' is the provider. Regards. Yann
_______________________________________________ Qgis-user mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
