[GIS] python gdal_polygonize error

gdalpython

I am trying to use gdal_polygonize to create a polygon from a binary raster.

My code is:

os.system('gdal_polygonize.py ' + filename + ' -f ESRI Shapefile ' + shapefile)

where filename is a string file path with a '.tif' extension and 'shapefile' has a .shp

I am receiving the following error message:

Creating output Shapefile of format ESRI.
Traceback (most recent call last):
  File "/usr/bin/gdal_polygonize.py", line 164, in <module>
    dst_ds = drv.CreateDataSource( dst_filename )
AttributeError: 'NoneType' object has no attribute 'CreateDataSource'

I have browsed the internet for help but to no avail. I am running the programme from NXclient on a windows 7 machine.

Any help would be greatly appreciated.

Becky

Best Answer

The problem was that I didn't use quotation marks when specifying output format: "ESRI Shapefile"

Related Question