I'm running into this error and I'm not quite sure what the error means. Novice here, operating out of jupyter environment, and trying to burn the vector layer of roads (road_lyr) into the raster road_ds.

gdal.RasterizeLayer( road_ds, [1], road_lyr, burn_values=[1], callback=gdal.TermProgress)

where my road_ds is

road_ds = gtiff_driver.Create('roads_prox.tif', in_band.XSize, in_band.YSize)

and road_lyr is

shp_ds = ogr.Open(folder)
road_lyr = shp_ds.GetLayerByName(roads_ln)

RuntimeError                              Traceback (most recent call last)
<ipython-input-16-b8a413aa8f73> in <module>()
----> 1 gdal.RasterizeLayer( road_ds, [1], road_lyr, burn_values=[1], callback=gdal.TermProgress)
C:\Anaconda3\lib\site-packages\osgeo\gdal.py in RasterizeLayer(*args, **kwargs)
   1622 def RasterizeLayer(*args, **kwargs):
   1623     """RasterizeLayer(Dataset dataset, int bands, Layer layer, void * pfnTransformer=None, void * pTransformArg=None, int burn_values=0, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> int"""
-> 1624     return _gdal.RasterizeLayer(*args, **kwargs)
   1626 def Polygonize(*args, **kwargs):
RuntimeError: Object given is not a Python function

How do I fix this?


1 Answer 1


I have met the same error before, and I solve the problem after I defaulted to the parameter 'callback'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.