On 23 June 2015 at 16:02, Even Rouault <[email protected]> wrote:
> Luca,
>

Hi Even,

>>
>> I'm writing a function to cycle inside the feature and update a column
>> of attribute table, if I print the feature with DumpReadable() I can
>> see the right attributes but when the script finish the final
>> shapefile has no attribute table, any idea?
>>
>> This is the relevant part of code
>>
>> featureDefn = lay0.GetLayerDefn()
>> field = ogr.FieldDefn(out_col, ogr.OFTReal)
>> featureDefn.AddFieldDefn(field)
>
> As suggested in http://gdal.org/python/osgeo.ogr.FeatureDefn-
> class.html#AddFieldDefn , you must call CreateField() on the layer object
> instead.
>

Also if I'm creating a new vector, not updating the existing one?

Because I use the featureDefn when I create the new feature, if I
understood well CreateField should be used only to create a new field
in an existing layer

> Even
>


-- 
ciao
Luca

http://gis.cri.fmach.it/delucchi/
www.lucadelu.org
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to