Hi,

Trying to simply export VRT layer , getting a wrong extent and exporting only 
extent of first raster part of VRT with this code :

      list_dalles = []

        features = layer.selectedFeatures()
        for f in features:
            file_name = f['NOM_DALLE']+'.tif'
            dir_name = f['repertoire']
            full_file_name = os.path.join( dir_name, file_name)

            if os.path.isfile(full_file_name):
                list_dalles.append(full_file_name)

        parameters = { 'ADD_ALPHA' : False,
                    'ASSIGN_CRS' : None,
                    'EXTRA' : '',
                    'INPUT' : list_dalles,
                    'OUTPUT' : outVRTfile,
                    'PROJ_DIFFERENCE' : False,
                    'RESAMPLING' : 0,
                    'RESOLUTION' : 0,
                    'SEPARATE' : False,
                    'SRC_NODATA' : '' }

        #processing.runAndLoadResults("gdal:buildvirtualraster", parameters)
        processing.run("gdal:buildvirtualraster", parameters)

        vrtLayer = QgsRasterLayer(full_file_name, "bidon")

        QgsProject.instance().addMapLayer(vrtLayer, True)

        file_writer = QgsRasterFileWriter(outfile)
        provider = vrtLayer.dataProvider()
        pipe = QgsRasterPipe()

        if not pipe.set(provider.clone()):
            print ("Cannot set pipe provider")

        print(str(provider.extent()))
        file_writer.writeRaster(
            pipe,
            provider.xSize(),
            provider.ySize(),
            provider.extent(),
            provider.crs())

I don't find anything about that, any idea ?

Thanks

[cid:image001.jpg@01DA1E31.806E1620]
Sylvain PIERRE
Chef de projet système d'information
Direction des Systèmes d'Information et du Développement Numérique
Service Projets et Ingénierie Numérique
Collectivité européenne d'Alsace
Tél : 03 88 76 68 88
sylvain.pie...@alsace.eu<mailto:sylvain.pie...@alsace.eu>
www.alsace.eu<http://www.alsace.eu>
[facebook]<http://www.facebook.com/toutelalsace> [twitter] 
<http://www.twitter.com/toutelalsace>  [insta] 
<http://www.instagram.com/toutelalsace>

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to