Skip to main content
Bumped by Community user
edited body
Source Link

I'm trying to use the gdal:rasterizeproximity function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

EDIT3: Getting results from processing.run GRASS r.resample in PyQGIS seems to have the same problem.

I'm trying to use the gdal:rasterize function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

EDIT3: Getting results from processing.run GRASS r.resample in PyQGIS seems to have the same problem.

I'm trying to use the gdal:proximity function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

EDIT3: Getting results from processing.run GRASS r.resample in PyQGIS seems to have the same problem.

edited title
Link

Using QGIS 3.12 gdal:rasterizeproximity doesn't output raster file in output location in PyQGIS standalone application

added 152 characters in body
Source Link

I'm trying to use the gdal:rasterize function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

EDIT3: Getting results from processing.run GRASS r.resample in PyQGIS seems to have the same problem.

I'm trying to use the gdal:rasterize function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

I'm trying to use the gdal:rasterize function from pyQGIS algorithms.

below is my code for trying to run the algorithms:

def publicgreen_qgis(self, in_fn):
        params = {'INPUT':in_fn,
       'FIELD':'1','BURN':1,'UNITS':1,'WIDTH':10,'HEIGHT':10,
       'EXTENT':'2667.53800002985,56396.4399999964,15748.72099999,50256.3342999838 [EPSG:3414]','NODATA':0,
       'OPTIONS':'','DATA_TYPE':5,'INIT':None,
       'INVERT':False,'EXTRA':'','OUTPUT':'TEMPORARY_OUTPUT'}

        feedback = QgsProcessingFeedback()

        res = processing.run("gdal:rasterize", params, feedback=feedback)

        params = {'INPUT':res['OUTPUT'],'BAND':1,
        'VALUES':'','UNITS':0,'MAX_DISTANCE':0,'REPLACE':0,
        'NODATA':0,'OPTIONS':'','EXTRA':'','DATA_TYPE':5,'OUTPUT':"test/file/proximity.tif"}

        res2 = processing.run("gdal:proximity", params, feedback=feedback)

Have tried running on QGIS python plugin with 'OUTPUT':'TEMPORARY_OUTPUT' but still doesn't output anything.

The code runs without error in my application, however, the output file I want is not created.

EDIT1: running from QGIS python plugin works, was not paying attention to my folder, however, still no output from the application.

EDIT2: have tried changing directories, running without GUI, only gdal:rasterized would give me an output, gdal:proximity still not giving me any output. Not sure how to check if the process is running as well. Program just runs without giving me an output or exception.

EDIT3: Getting results from processing.run GRASS r.resample in PyQGIS seems to have the same problem.

added 262 characters in body
Source Link
Loading
added 47 characters in body
Source Link
Loading
added 87 characters in body
Source Link
Loading
deleted 238 characters in body
Source Link
Loading
Source Link
Loading