[Gdal-dev] easy ogr question...

Will Cadell wmc at timberline.ca
Mon Sep 18 16:28:17 EDT 2006


hi guys... am i just stupid or is there another way to add a field to a
shapefile other than:
   
    ds = ogr.open("c:\shapefile.shp", True)
   
    new_field = ogr.FieldDefn()
    new_field.SetName(new_field_name)
    new_field.SetType(new_field_type)
    new_field.SetWidth(new_field_width)
   
    layer = ds.GetLayer(0)
    layer.CreateField(new_field)
   
    ds.destroy

because this doesn't work for me...

please help, Will

-- 
Will Cadell
Remote Sensing and GIS Analyst

   /\/\
  /  \ \
 /  Timberline
/   Forest Inventory Consultants

tel:(250) 562 2628       address: 1579 9th Ave,
skype: geo_will                   Prince George,
loc: 53.9135N, 122.7544W          BC, Canada 

www.timberline.ca




More information about the Gdal-dev mailing list