TransWikia.com

gdalnumeric.LoadFile() with temporary output from QGIS algorithm

Geographic Information Systems Asked on November 21, 2021

I’m trying to access a previously created temporary raster output with gdalnumeric.LoadFile() to calculate some statistics. It seems to me that gdalnumeric.LoadFile() can only access a file through a file path and not with a QGIS temporary output.

I tried without success:

import gdalnumeric
path="C:Users...xxx.gpkg"
raster = processing.run("gdal:rasterize", {'INPUT':path,'FIELD':'','BURN':1,'UNITS':1,'WIDTH':50,'HEIGHT':50,'EXTENT':'32351398.3019399,32593108.6666274,5366514.87416986,6045057.7298552 [EPSG:5652]','NODATA':0,'OPTIONS':'','DATA_TYPE':0,'INIT':None,'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'})
raster_file = raster['OUTPUT']

Is there a way to access the temporary raster with gdalnumeric.LoadFile()? Or do I need to use a QGIS native algorithm to continue my analysis?

One Answer

Why don't you change 'OUTPUT':'TEMPORARY_OUTPUT' to 'OUTPUT':'/tmp/myfile.tif' and then use gdalnumeric.LoadFile() on it?

Answered by ThomasG77 on November 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP