Wrong field type in osgeo.org for ogr.FieldDefn('field', ogr.OFTInteger)
Question: I have a problem with osgeo.org for python using versions

    
    
    python version 2.7  
    osgeo.org version 1.3.39
    

I want to use osgeo to convert `MapInfo File` from MongoDB.

With

    
    
    from osgeo import ogr, osr, gdal   
    driver = ogr.GetDriverByName("MapInfo File")     
    number_of_rooms = ogr.FieldDefn('number_of_rooms', ogr.OFTInteger)    
    feature.SetField("number_of_rooms ",num)    
    layer.CreateFeature(feature)
    

the `MapInfo File` is built but the field `number_of_romms`'s type is
`Integer(12)` whereas I want it to be `Integer` and can't figure out the
problem.

Is there any way to solve this issue?

The mif file is the following:

    
    
    Version 300              
    Charset "Neutral"   
    Delimiter ","    
    CoordSys Earth Projection 1, 104  
    Columns 19        
    
    [...]
    
    number_of_rooms Integer(12) //i want number_of_rooms Integer
    
    Data
    [...]
    


Answer: Not sure if I get you right but if it is the precision or width of the field
you want to change you can use:

    
    
    number_of_rooms = ogr.FieldDefn('number_of_rooms', ogr.OFTInteger)
    number_of_rooms.SetPrecision(int_new_precision)
    

Read more at: <http://gdal.org/python/>

