[gdal-dev] ogr2ogr midmif to tab format conversion

Frank Warmerdam warmerdam at pobox.com
Fri Apr 29 10:03:59 EDT 2011


On 11-04-29 08:25 AM, Zoltan Szecsei wrote:
> Hi All,
> I am trying to convert a bunch of MapInfo MID-MIF files to MapInfo TAB files,
> because GeoMedia 6.1 will not "connect" to MIDMIF files.
> Using this script on Ubuntu 10.04, ogr2ogr from GDAL 1.8.0, released 2011/01/12
>
>
>
> for m in `ls *.mif` ; do n=`echo $m | awk -F . ' { print $1".tab" } ' ` ; echo
> "******************** Starting $m" ; ogr2ogr -F "MapInfo File" $n $m ; done
>
> (Basically: ogr2ogr -F "MapInfo File" boundaries.tab boundaries.mif )
>
>
>
>
> When I load the resulting .TAB, .ID, .MAP and .DAT files into GeoMedia, I get
> coarse boxes and diagonal lines, albeit in the correct LatLong region.
>
> When I use a very old "imutgui" from an old MapInfo to convert the same MID
> MIFs to SHAPE, I can (correctly) load the SHAPEs into GeoMedia.
>
> I cannot use the SHAPEfile route as the field names are truncated when
> converting from MIDMIF to SHAPE.
>
>
> Any idea why the TAB route messes up the geometries?

Zoltan,

As discussed in http://www.gdal.org/ogr/drv_mitab.html the driver needs to
set a bounds for coordinates which determines precision.  If it doesn't
know the coordinate system it won't know that the bounds should be small
(and hence the precision high) for latitudes and longitudes.   Try adding
-a_srs WGS84 to your ogr2ogr command to tell OGR that the coordinate system
is geographic.


eg.

ogr2ogr -f "MapInfo File" -a_srs WGS84 $n $m

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