Create Mapinfo's Thematic Maps Or Shade with Access/VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yus2aces
    New Member
    • Sep 2012
    • 14

    Create Mapinfo's Thematic Maps Or Shade with Access/VBA

    Hi all,

    I am new in MapInfo. I can open *.TAB within Access/VBA. The next step is to try build a thematic map (Shade) programmaticall y based on *.TAB information.

    I don't have any idea where to start. Could anybody shares a sample code or method to accomplish this.

    Thank you in advance.

    Yus2Aces
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Yus2Aces,
    What have you tried so far?
    Access really isn't a map making/graphic software so it may not be suitable for your application. Perhaps you can provide alot more information and the code you've already tried?

    Comment

    • yus2aces
      New Member
      • Sep 2012
      • 14

      #3
      Access is only to display the map (*.TAB) from Mapinfo. And by using Mapbasic command I want to automate shade the map based on one field within the mapinfo's table.

      I have gather the Mapbasic command, which I have no clue to write it in VBA.

      Code:
      shade 1 with Thn_Tnm ignore "" values 
        "1995" Brush (2,16752800,16777215) ,
        "1996" Brush (2,16777104,16777215) ,
        "1997" Brush (2,16749680,16777215) ,
        "1998" Brush (2,7381247,16777215) ,
        "2003" Brush (2,16744640,16777215) ,
        "2004" Brush (2,11796288,16777215) ,
        "2005" Brush (2,61680,16777215) ,
        "2009" Brush (2,16760832,16777215) ,
        "2010" Brush (2,53352,16777215) ,
        "Empl" Brush (2,10543359,16777215) ,
        "Encl" Brush (2,16752848,16777215) ,
        "PKS" Brush (2,10551295,16777215) 
        default Brush (2,0,16777215)   # color 1 #
      The above code will shade the map (thematic map) based on plant's planting year with each brush code define the forecolor and backcolor.

      What I am confuse is how to select and grouping the year from the table and inform the mapinfo to shade based on them. I have prepare the identical temp table in Access to try to group them.

      Also think to build a ready-made workspace from mapinfo, so I can easily use from within VBA. But I am stuck, because I can't make the workspace works in VBA by using this code.

      Code:
      Sub Form_Load
      
      Dim mi as object
      
      Set MIObject = CreateObject("mapinfo.application")
      MIObject.do "Set Application Window " & Me.hwnd
      MIObject.do "Set Next Document Parent " & Form_frmMapInfo.Controls!DisplayMap.Form.hwnd & " Style 1"
      MIObject.do "Run Application """ & CurrentProject.Path & "\world.wor""""
      MIObject.runmenucommand 1702
      wnd = MIObject.Eval("FrontWindow()")
      MIObject.do "Set Window " & str$(wnd) & " Min"
      MIObject.do "Set Window " & str$(wnd) & " Max"
      MIObject.do "Set Window " & str$(wnd) & " ScrollBars On"
      MIObject.do "Create Menu ""Mapper Shortcut"" ID 17 As ""(-"" "
      
      End Sub
      Or maybe someone have another working method?

      Comment

      Working...