3

Given a topographic raster tif of an european country where elevations are simplyfied to either 0, either 200.

How to create a polygon ?


Comment: With the following polygonize.py command:

gdal_polygonize.py level200.tif -f "ESRI_Shapefile" level200.shp

I get to following error:

Creating output level200.shp of format ESRI_Shapefile.
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'
4
  • 5
    Are you sure it's not ESRI Shapefile? (No underscore)
    – Nathan W
    Commented Aug 20, 2013 at 4:48
  • If formerly used ESRI Shapefile but then got -at some stage- a feedback recommanding me to use ESRI_Shapefile. Now, it appear that ESRI Shapefile make the stuff work.
    – Hugolpz
    Commented Aug 20, 2013 at 4:57
  • You may post your advice as an answer together with gdal.org/ogr/ogr_formats.html so I validate it :)
    – Hugolpz
    Commented Aug 20, 2013 at 4:59
  • It's fine. You can answer it and get the rep. I have plenty :)
    – Nathan W
    Commented Aug 20, 2013 at 5:17

1 Answer 1

6
  1. AttributeError: 'NoneType' object has no attribute 'CreateDataSource' means the format -f is incorrect.
  2. Checking the manual : http://gdal.org/ogr/ogr_formats.html , the shape file format is ESRI Shapefile (no underscore).
  3. Try without underscore:

    gdal_polygonize.py level200.tif -f "ESRI Shapefile" level200.shp

    it works. :)

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.