I'm trying to convert a csv file to an ESRI Shapefile with OGR in Python. The problem is obviously that my header entries are too long for the default field size:
Warning 6: Normalized/laundered field name: 'SEEHOEHE [m]' to 'SEEHOEHE ['
I want to loop over all header elements (the number of columns in my csv file is unknown) and create new fields in the shapefile - "on the fly", so to speak:
for i in range(0,len(header)):
layer_out.CreateField(ogr.FieldDefn(header[i], ogr.OFTString))
works fine, but with the header entries cut off (this is problematic, because i need to address them later on). Is there a way to define the header entry size in the same step? I tried it with SetField(32)
, but I fear this alters only the size for the table entries.
Can anyone help? Thanks in advance!