2

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

asked May 8, 2013 at 17:18
2
  • 2
    Try directly the command gdal_polygonize.py my_tif.tif -f "ESRI Shapefile" my_shapefile.shp to be sure that the os.system call is not the problem. You also forgot the double quotes for "ESRI Shapefile" Commented May 8, 2013 at 22:23
  • Thanks for that - The problem was solved simply by putting in the quotation marks in : "ESRI Shapefile" Commented May 9, 2013 at 9:34

1 Answer 1

1

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

answered May 9, 2013 at 9:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.