By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

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

P: 14
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) programmatically 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
Sep 13 '12 #1
Share this Question
Share on Google+
2 Replies


zmbd
Expert Mod 5K+
P: 5,287
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?
Sep 13 '12 #2

P: 14
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.

Expand|Select|Wrap|Line Numbers
  1. shade 1 with Thn_Tnm ignore "" values 
  2.   "1995" Brush (2,16752800,16777215) ,
  3.   "1996" Brush (2,16777104,16777215) ,
  4.   "1997" Brush (2,16749680,16777215) ,
  5.   "1998" Brush (2,7381247,16777215) ,
  6.   "2003" Brush (2,16744640,16777215) ,
  7.   "2004" Brush (2,11796288,16777215) ,
  8.   "2005" Brush (2,61680,16777215) ,
  9.   "2009" Brush (2,16760832,16777215) ,
  10.   "2010" Brush (2,53352,16777215) ,
  11.   "Empl" Brush (2,10543359,16777215) ,
  12.   "Encl" Brush (2,16752848,16777215) ,
  13.   "PKS" Brush (2,10551295,16777215) 
  14.   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.

Expand|Select|Wrap|Line Numbers
  1. Sub Form_Load
  2.  
  3. Dim mi as object
  4.  
  5. Set MIObject = CreateObject("mapinfo.application")
  6. MIObject.do "Set Application Window " & Me.hwnd
  7. MIObject.do "Set Next Document Parent " & Form_frmMapInfo.Controls!DisplayMap.Form.hwnd & " Style 1"
  8. MIObject.do "Run Application """ & CurrentProject.Path & "\world.wor""""
  9. MIObject.runmenucommand 1702
  10. wnd = MIObject.Eval("FrontWindow()")
  11. MIObject.do "Set Window " & str$(wnd) & " Min"
  12. MIObject.do "Set Window " & str$(wnd) & " Max"
  13. MIObject.do "Set Window " & str$(wnd) & " ScrollBars On"
  14. MIObject.do "Create Menu ""Mapper Shortcut"" ID 17 As ""(-"" "
  15.  
  16. End Sub
Or maybe someone have another working method?
Sep 13 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.