MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Mappoint 2k and boundaries

This is a discussion on Mappoint 2k and boundaries within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Is there any way to combine seperate maps with seperate yellow boundaries (areas to avoid) into one map without having ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-16-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Mappoint 2k and boundaries

Is there any way to combine seperate maps with seperate yellow boundaries (areas to avoid) into one map without having to copy and paste every single manually drawn boundary from one map to another?

Thanks to anyone who can help me with this!
bwinkeler@scholasticbookfairs .com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 12-16-2003
Junior Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 28
Assuming you have access to some Microsoft Office product:

This is not elegant, but will work in Word, Excel or Access in Office XP or 2003. I am not sure about 2000 because this uses the Application.FileDialog box which was not accessible in earlier Office versions.

If you are a VBA Wiz then skip this and go on to the code, otherwise:
In Word or Excel you will need to go Tools > Macro > Visual Basic Editor and insert a module. Copy and paste the code into the module. From the visual basic editor window, go to Tools > References and in the dialog box that pops up, check the box next to Microsoft MapPoint 9.0 Object Library (or whatever your version is). Save the module. Run the module by pressing F5 while the Visual Basic Editor is the active window.

The same basic stuff will work in Visual Basic, with the exception of the FileDialog, you will need to replace it with the CommonDialog control or some other way of getting the file paths and names.


Code:
Private Sub CopyShapes()
   'general variables
   Dim srcFile As String
   Dim targFile As String
   Dim selItem As Variant
 '  Dim mpYellow As Long
   'mappoint variables
   Dim MPApp1 As MapPoint.Application
   Dim MPApp2 As MapPoint.Application
   Dim MPMap1 As MapPoint.Map
   Dim MPMap2 As MapPoint.Map
   Dim MPShape As MapPoint.Shape
   'application variables
   Dim FD As FileDialog
   
  ' mpYellow = &HFFFF&
   
   'set up file dialog and get source file name
   Set FD = Application.FileDialog(msoFileDialogFilePicker)
   FD.AllowMultiSelect = False
   FD.Filters.Clear
   
   FD.Filters.Add "MapPoint Files", "*.ptm"
   
   'select target file
   With FD
      .Title = "Select the file to which you want to copy:"
      If .Show = -1 Then
          For Each selItem In FD.SelectedItems
             targFile = selItem
          Next
      Else
        'user pressed cancel, no file to process so exit
        Exit Sub
      End If
   End With
   
   'initialize target map
   Set MPApp1 = CreateObject("Mappoint.Application")
   Set MPMap1 = MPApp1.OpenMap(targFile, False)
 
   'you might want to put this at the end
   'the map spins and moves around a lot as the
   'copy work is being done
   'disadvantage to moving to the end is if an error occurs
   'MapPoint will run in the background unless you kill it in the 
   'task manager
   MPApp1.Visible = True
   MPApp1.UserControl = True
   
   Application.Activate
   'select source files
   With FD
      .AllowMultiSelect = True
      .Title = "Copy shapes from:"
      If .Show = -1 Then
          For Each selItem In FD.SelectedItems
             srcFile = selItem
 
   
          Set MPApp2 = CreateObject("Mappoint.Application")
          Set MPMap2 = MPApp2.OpenMap(srcFile, True)
          MPApp2.Visible = True
          MPApp2.UserControl = True

          'this part will make you dizzy if you choose to 
          'make the applications visible
          For Each MPShape In MPMap2.Shapes
             If MPShape.Type = geoFreeform Or geoAutoShape Then
                MPShape.Copy
                MPMap1.Paste
             End If
          Next

            Next
      Else
        'user pressed cancel, no file to process so exit
        Exit Sub
      End If
   End With
   'clean up
   
   Set MPApp1 = Nothing
   Set MPApp2 = Nothing
   
   Set MPMap1 = Nothing
   Set MPMap2 = Nothing
   
   Set MPShape = Nothing
   Set FD = Nothing
End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 12-17-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Thanks!....but

Here is alittle more info. We are using Windows 2000 pro, office 2000, and mappoint 2002 and a program called Direct Route from Appian Logistics.

Will your above code work in this setup? I can get all the way to save the module and press f5 to run the module and a macro box pops up. I don't know what to do here and how do I get this to tie into mappoint 2002 to copy my boundaries?

Thanks again for your help!
bwinkeler@scholasticbookfairs.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 12-18-2003
Junior Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 28
Sorry, I left a few steps out and made a mistake. Change the Private to Public in the first line:
Code:
Public Sub CopyShapes()
This will then show up as an available macro when you press F5 while in the Visual Basic editor or select Tools > Macros > Run Macro from the application toolbar (if you are running from Word or Excel for example).

I have this as an add-in that you can run directly from MapPoint so that you don't have to open and close files. I just can't guarantee that it won't conflict with something else you are running. Running the macro takes an extra few steps, but should work pretty reliably.

Now, when you have made the above change and saved the file, either press F5 or select run macro. You should see CopyShapes as an available macro. This is where things may not work with Office 2000. Run it and you should get a dialog box prompting you to select the file to which you want to copy the shapes. (I can't remember if Office 2000 supports the FileDialog objectj or if 2002/XP was the version it became developer-friendly). This is the destination file. Once you have selected the destination file, you will receive a prompt to select the source files. You may select more than one file as long as all the files you select reside in the same directory.

So you might select AllZones as a newly created, blank map. You might then select Zone1, Zone2, and Zone3 as the source maps. The macro will copy all shapes that are freeform or autoshapes from Zone1, Zone2 and Zone3 to AllZones. All of the maps will stay open so that you can make sure that everything is copied correctly.

If the above works and you want to specify just boundaries filled with yellow, you need to remove the apostrophe before mpYellow = &HFFFF& and change the line
Code:
If MPShape.Type = geoFreeform Or geoAutoShape Then
to
Code:
 If MPShape.Fill.ForeColor = mpYellow And (MPShape.Type = geoFreeform Or geoAutoShape) Then
Now, if after all that, you find that the dialog box doesn't work with Office 2000 and you aren't running any MapPoint Add-ins I can send you my utility functions. I have no error checking because I only use it to make repetitive tasks easier and I'm the only person using it. It copies shapes and lines, shows/hides balloons and names by dataset, changes line colors in bulk, etc.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 12-18-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Help us Martel

Please send me an email address so I can send you our phone # here at Scholastic Book Fairs and we can talk while I go thru this step-by-step. We can't get your code to work!

Thanks
bwinkeler@scholasticbookfairs.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 12-18-2003
Junior Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 28
Let me add some things to my add-in and I will send it to you along with some instructions.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 12-19-2003
Junior Member
Yellow Belt
 
Join Date: Feb 2003
Posts: 28
You should receive a link by e-mail with some instructions on how to add and test the add-in. See if it will run for you. If you have problems (you may receive some error like "Cannot find COMCTL32.dll" or "Wrong version COMCTL32.ocx" or something along those lines) contact me through e-mail and I will use a different version. I was trying to keep the file small. Nothing like version compatibility issues
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
boundaries, mappoint


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Territory Boundaries Anonymous MapPoint 2006/2009 Discussion 3 05-20-2004 05:48 PM
Showing all MSA boundaries on USA map Anonymous MapPoint 2006/2009 Discussion 0 05-18-2003 05:51 PM
MapPoint 2003 and census 2000 tract boundaries Anonymous MapPoint 2006/2009 Discussion 2 04-20-2003 07:03 AM
Importing 2000 Census boundaries into MapPoint Anonymous MapPoint 2006/2009 Discussion 5 12-13-2002 06:36 PM
Will MapPoint include UK political boundaries, par.... Anonymous MapPoint 2006/2009 Discussion 1 07-26-2001 08:44 AM


All times are GMT -5. The time now is 01:42 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54