I believe I original wrote the Delphi code for IMUT comming with MI 6.5 and 
have never experienced any problems in the Shape / TAB conversion on later MI 
versions, I've have never tried batch converting between other formats than TAB 
/ Shape.


Jakob Lanstorp
Software Consultant
Geographical Information & IT 

COWI A/S
Odensevej 95
DK-5260 Odense S

Tel  +45 6311 4900
Fax  +45 6311 4949
Mob  +45 5050 8087
E-mail [EMAIL PROTECTED]
http://www.cowi.dk
http://www.cowi.com


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SCISOFT
Sent: Monday, November 14, 2005 11:03 AM
To: MapInfo-L@lists.directionsmag.com
Subject: RE: [Mapinfo-l] Programmatic MapInfo TAB to Shapefile translation


Mats, Jakob, others

I wonder if any of you has a method to detect the version of MI (and therefore, 
the UT or IMUT) which is installed, and also knows which formats can be 
cross-translated (by the shellexecute of the UT, through Delphi or other code); 
and how reliable the translation is? 

The reason for this is obviously that batch conversion is nice (via a simple 
tool that runs the UT) but only if the UT handler application "knows" how to do 
reliable conversions / translations. 

For instance, I use MI 6.5 myself. I find its version of the UT very annoying, 
and its range of formats for the MapInfo Pro 6.5 version is very limited. I 
(and many others on this list) could write a much easier to use batch-oriented 
utility that runs the UT.  But it would be more useful to people owning 7.0 / 
7.5 / 7.8 / 8.0 if the application knew which cross-translations were possible, 
for the UT / IMUT that is supplied with the various MI versions.  

Reliability of the conversion: that's another matter (something that someone 
might collate or assemble, in the way that Jacques Paris has done for the 
MapBasic versions). 

IL Thomas - Perth, Australia
GeoSciSoft
________________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jakob Lanstorp
Sent: Monday, November 14, 2005 4:29 PM
To: Llewellyn, David
Cc: MapInfo-L@lists.directionsmag.com
Subject: RE: [Mapinfo-l] Programmatic MapInfo TAB to Shapefile translation

This is how IMUT is used with Delphi. You can use it as pseudocode for a 
MapBasic application:
 
function TForm1.Tab2Shp(srcfile, destfile : String) : Boolean; //Convert a 
source MapInfo tab file to a destination ESRI shape file with external 
Universal Translator macro var
  str        : String;             //String holder
  pathIMUT   : String;             //Path to external FME application
  pathSrc    : String;             //PAth to Source file (MapInfo TAB vector
files)
  pathDest   : String;             //Path to destination files (ESRI SHP vector 
files)
  tabnam     : String;             //Source table name
  tmpdat     : string;             //Temp dat file for IMUT
  sParam     : string;             //Parametre to INUT.EXE
  FileStream : TFileStream;        //Used to write hggtemp2.dat
  StringList : TStringList;
begin
  Result := False;
 
  //Step 1: Gernerate FME script - Run command line:
  pathIMUT := ExtractFilePath(Application.ExeName)+'UT\';
  pathSrc  := ExtractFilePath(srcfile);
  pathSrc  := Copy(pathSrc,1,Length(pathSrc)-1) + '/';            //Change 
trailing \ to /
  pathSrc  := AnsiQuotedStr(pathSrc,#34);                         //Add Quoates 
and trailing space
  tmpdat   := AnsiQuotedStr('hggtemp1.dat',#34);
  pathDest := ExtractFilePath(destfile);
  tabnam   := 
Copy(ExtractFileName(srcfile),1,Length(ExtractFileName(srcfile))-4);  //Get 
MapInfo Tabelname
  sParam   := 'CFGenerate MAPINFO SHAPE ' + pathSrc + ' ' + tmpdat + ' 
LOG_STANDARDOUT YES +ID ' + tabnam;
 
  //Batch = IMUT.EXE CFGenerate MAPINFO SHAPE "C:\HGG\Code\UT\MIdir/" 
"hggtemp1.dat" LOG_STANDARDOUT YES +ID "komg2002"
 
ShellExecute(Application.Handle,'OPEN',PChar(pathIMUT+'IMUT.EXE'),PChar(sPar
am),PChar(pathIMUT),SW_HIDE);
 
  //Step 2: Create control file - Named hggtemp2.dat
  StringList := TStringList.Create;
  StringList.Add('MACRO _EXTENSION TAB');
  StringList.Add('MACRO _BASENAME ' + tabnam);
  StringList.Add('MACRO _FULLBASENAME ' + tabnam);
  StringList.Add('MACRO SourceDataset ' + pathSrc);
  pathDest := Copy(pathDest,1,Length(pathDest)-1);                // Remove 
trailing slash
  StringList.Add('MACRO DestDataset ' + pathDest);
  StringList.Add('INCLUDE hggtemp1.dat');                         //Add double 
quoates
  tabnam   := AnsiQuotedStr(tabnam,#34);                          //Get MapInfo 
Tabelname
  StringList.Add('MAPINFO_IDs ' + tabnam);
  StringList.Add('MAPINFO_IN_IDs ' + tabnam);
  StringList.SaveToFile(pathIMUT+'hggtemp2.dat');
  StringList.Free;
 
  //Step 3: Final executation - Command line: imut.exe hggtemp2.dat
  sParam := 'hggtemp2.dat';
 
ShellExecute(Application.Handle,'OPEN',PChar(pathIMUT+'IMUT.EXE'),PChar(sPar
am),PChar(pathIMUT),SW_HIDE);
 
  Result := True;
end;
 
 
HTH
Jakob Lanstorp 
Software Consultant 
Geographical Information & IT 
COWI A/S 
Odensevej 95 
DK-5260 Odense S 
Tel  +45 6311 4900 
Fax  +45 6311 4949 
Mob  +45 5050 8087 
E-mail [EMAIL PROTECTED] 
http://www.cowi.dk 
http://www.cowi.com 
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Llewellyn, David
Sent: Monday, November 14, 2005 8:45 AM
To: MapInfo-L@lists.directionsmag.com
Subject: [Mapinfo-l] Programmatic MapInfo TAB to Shapefile translation Hi all, 
Does anyone know of a way to run a MapInfo TAB to Shapefile translation via 
MapBasic? Or is there a command line way to invoke the Universal Tanslator? 
This would save a fair bit of manual work using the Universal Translator. 
Thanks. David Llewellyn Geospatial Specialist Regional Team (West) NNTT 
Principal Registry, Perth
Phone: 08 9268 7477
Email: [EMAIL PROTECTED]


_______________________________________________
Mapinfo-l mailing list
Mapinfo-l@lists.directionsmag.com 
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
Mapinfo-l mailing list
Mapinfo-l@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to