[FWTools] CreateField on existing shape file

Bijoy Nair bijoyn at valuecad.com
Thu Jun 21 11:45:47 EDT 2007

I am trying to add a new field on an existing shape file using ogr 
python bindings but it seems to fail. The same steps work correctly when 
a new shape file is created and a field is added to it.

 >>> from gdal import ogr
 >>> ds = ogr.Open('d:/temp/delete-dublin-shapes',update = 1)
 >>> lyr = ds.GetLayerByName('Zones')
 >>> field = ogr.FieldDefn('Project',ogr.OFTString)
 >>> field.SetWidth(100)
 >>> lyr.CreateField(field)

Any help would be appreciated.


More information about the FWTools mailing list