[gdal-dev] Data types change converting from MID/MIF to SHP

Frank Warmerdam warmerdam at pobox.com
Wed Nov 24 09:12:57 EST 2010

Zoltan Szecsei wrote:
> Hi,
> Here's a strange one that hopefully can be overcome quickly.
> I'd be grateful for any assistance with this problem.
> Kind regards,
> Zoltan
> I have a MID/MIF file combination with:
>     FEAT_TYPE_ integer (5)
>     GID integer (10)
>     ENTITY_NAM char (50)
>     GEOMETRY_T char (5)
>     AUD_MOD char (5)
> yet as a SHP file, the two Integer fields become Real 11.0 - yes, both 11.0
> I have used both QGis 1.5.0 and an old MapInfo Imutgui.exe to do this 
> conversion, and I get the same results.


I can confirm that OGR is ignoring the precision of integer fields when
translating and thus "integer 5" is just treated as "integer".  This in
turn get translated to an 11 character wide field in the dbf file to
hold the largest 32bit integer.  But when reading back such a wide field
the shapefile driver treats it as "real" since the largest 11 character
wide integer is larger than 32 bits.

In GDAL/OGR trunk I've changed the shapefile driver a few weeks ago so that
unknown width fields are treated as 10 wide integer fields which are still
treated as integer when read back in an effort to partly avoid this sort of
problem.  I'm not sure if that change was backported.

But I think there is also an issue with the mapinfo driver which seems to
be ignoring the precision of integer fields.  I found it also ignores the
precision of Decimal fields which are treated as real even if there are
no decimal points.

Could you file a ticket in the GDAL/OGR Trac on this?  I'll try to get it
fixed up for GDAL/OGR 1.8.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list