Questions tagged «qgis-python-console»

4
获取QGIS 2.x python代码以在QGIS 3.x中工作?对象没有属性“ legendInterface”的问题
下面的代码在QGIS 2.x中运行良好,但是在QGIS 3.x中不起作用。 myDir = 'd:/work/output_folder/' layers = iface.legendInterface().layers() pipe = QgsRasterPipe() for layer in layers: extent = layer.extent() width, height = layer.width(), layer.height() renderer = layer.renderer() provider=layer.dataProvider() crs = layer.crs().toWkt() pipe.set(provider.clone()) pipe.set(renderer.clone()) opts = ["COMPRESS=LZW"] file_writer = QgsRasterFileWriter(myDir + layer.name() + ".tif") file_writer.setCreateOptions(opts) file_writer.writeRaster(pipe, width, height, extent, layer.crs()) 这是我运行代码时遇到的错误: …


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.