Click here to Skip to main content
6,822,613 members and growing! (20,295 online)
Email Password   helpLost your password?
Web Development » Applications & Tools » General     Intermediate

Mapinfo tab to ESRI shapefile conveter

By sun_xf

A batch converting tool that can convert GIS data from "mapinfo tab" to "ESRI shapefile"
VC6Win2K, WinXP, MFC, Dev
Posted:18 Jun 2006
Views:38,109
Bookmarked:19 times
Unedited contribution
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
9 votes for this article.
Popularity: 1.91 Rating: 2.00 out of 5
6 votes, 66.7%
1

2
1 vote, 11.1%
3
1 vote, 11.1%
4
1 vote, 11.1%
5

Sample Image - MapinfoTab2Shp.jpg

Introduction

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.

Using the code

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);
            }
        }
    }

Points of Interest

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.

History

First release.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

sun_xf


Member

Occupation: Web Developer
Location: China China

Other popular Applications & Tools articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
GeneralEnglish please PinmemberMuammar©2:09 5 Jun '07  
GeneralMapinfdo file format PinmemberAlexEvans14:12 19 Jun '06  
GeneralRe: Mapinfo file format Pinmembergxdata19:13 19 Jun '06  
General?? PinmemberDarka0:09 19 Jun '06  
GeneralRe: ?? Pinmembertrevor.hart1:13 19 Jun '06  
GeneralRe: ?? PinmemberDarka1:17 19 Jun '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin 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