![]() |
Web Development »
Applications & Tools »
General
Intermediate
Mapinfo tab to ESRI shapefile conveterBy sun_xfA batch converting tool that can convert GIS data from "mapinfo tab" to "ESRI shapefile" |
VC6Win2K, WinXP, MFC, Dev
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

Mapinfo tab to ESRI shapefile conveter can convert MapInfo vector tables to the ESRI shape format. Implemented as a command line interface to IMUT.exe.
This is a code sample and will only work with Universal Translator Imut files.
char szExeFile[1024];
sprintf(szExeFile, "\"%s\\imut.exe\" CFGenerate MAPINFO SHAPE \"%s/\" hggtemp1.dat LOG_STANDARDOUT YES",
(LPCTSTR)m_strImut,(LPCTSTR)strFilePath);
STARTUPINFO si;
GetStartupInfo( &si );
PROCESS_INFORMATION pi;
si.dwFlags = STARTF_FORCEONFEEDBACK;
si.wShowWindow = SW_HIDE;
if(CreateProcess(NULL,
szExeFile,
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
NULL,
(LPCTSTR)m_strImut,
&si,
&pi))
{
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
//GetExitCodeProcess(pi.hProcess, &dwExitCode);
CloseHandle(pi.hProcess);
FILE *fp;
sprintf(szExeFile, "%s\\hggtemp2.dat",(LPCTSTR)m_strImut);
if((fp = fopen(szExeFile, "wt")) != NULL)
{
fprintf( fp, "MACRO _EXTENSION TAB\n");
fprintf( fp, "MACRO SourceDataset %s\n", (LPCTSTR)strFilePath);
fprintf( fp, "MACRO DestDataset %s\n", strDstPath);
fprintf( fp, "INCLUDE hggtemp1.dat\n");
fclose(fp);
sprintf(szExeFile, "\"%s\\imut.exe\" hggtemp2.dat", (LPCTSTR)m_strImut);
if(CreateProcess(NULL,
szExeFile,
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
NULL,
(LPCTSTR)m_strImut,
&si,
&pi))
{
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, INFINITE);
//GetExitCodeProcess(pi.hProcess, &dwExitCode);
CloseHandle(pi.hProcess);
}
}
}
The tool can convert a lots of tab files(locate in different directory) to shapefile format. Manual operate is a tired trouble thing, may make an error.
First release.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 18 Jun 2006 Editor: |
Copyright 2006 by sun_xf Everything else Copyright © CodeProject, 1999-2010 Web17 | Advertise on the Code Project |