Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 5 of 5

Copying multiple shapes

This is a discussion on Copying multiple shapes within the MapPoint Desktop Discussion forums, part of the Map Forums category; We have 3 seperate maps that each contain a set of pushpins and around each pushpin is drawn a shape ...

  1. #1
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103

    Copying multiple shapes

    We have 3 seperate maps that each contain a set of pushpins and around each pushpin is drawn a shape (catchment area).
    I am trying to merge these 3 maps into 1 and I can import all of the ushpins from each map ok.
    Where i'm having trouble is copying the shapes into the single map, I can copy them one at a time but this isn't really practical as there are over 10,000 of these. Is it possible to copy multiple shapes from one map to another, if not through mappoint then programaticaly through vb.

    I really could do with some help on this, going through 10,000 of them one at a time is going to be a nightmare!

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4
    Dazzer,

    There's a mif/mid exporter, it's not perfect but it would allow you to get the shapes out programmatically, manipulate them as text or with a GIS program, and re-import them.

    Walt Cygan wrote the mif/mid exporter, it is here:
    http://www.mp2kmag.com/importersub01.asp
    There's also a compiled version in one of the old newsletters, look for "three new utilities".

    You may encounter some errors, but it should give you a good starting point.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Excellent, thanks for your help

    I'll have a look at this and see what I can do with it.

    Thanks again for your help

  4. #4
    Martel is offline Junior Member Yellow Belt
    Join Date
    Feb 2003
    Posts
    28
    I had to copy a bunch of shapes (freeform lines) that had been hand-drawn to represent areas on the map. You should be able to adapt this to your needs or use it as a start. MapPoint is nice in that the shapes paste to the same location from which they were copied.

    '** g_App is a reference to the current application **
    Private Sub btnCopyAllShapes_Click()
    Dim oSrcApp As mappoint.Application
    Dim oSrcMap As mappoint.Map
    Dim oTargMap As mappoint.Map
    Dim oShape As mappoint.Shape
    Dim sFiles() As String
    Dim i As Integer

    'set current map as target
    Set oTargMap = g_App.ActiveMap

    On Error GoTo ErrorHandler
    'get source map
    With CmnDlg
    .Flags = cdlOFNLongNames Or cdlOFNExplorer
    .DialogTitle = "Select Target Map:"
    .CancelError = True
    .Filter = "MapPoint Files (*.ptm)|*.ptm"
    .ShowOpen
    End With
    If Len(CmnDlg.FileName) > 0 Or Not IsNull(CmnDlg.FileName) Then
    'set up target files
    Set oSrcApp = CreateObject("MapPoint.Application")
    Set oSrcMap = oTargApp.OpenMap(CmnDlg.FileName)
    'make the application visible so the user can compare shapes and locations
    oSrcApp.UserControl = True
    oSrcApp.Visible = True

    'copy shapes to target files
    For Each oShape In oSrcMap.Shapes
    'either add the type of shape to copy or remove completely to get all shapes
    'I was only looking for particular shapes
    If oShape.Type = geoAutoShape Or geoFreeform Then
    'copy from source
    oShape.Copy
    'paste to target
    oTargMap.Paste
    End If
    Next
    End If


    Exit_:
    'set focus back to target app
    If IsObject(oTargApp) Then
    oTargApp.Activate
    End If
    'dereference everything
    Set oTargApp = Nothing
    Set oTargMap = Nothing
    Set oSrcMap = Nothing
    Set oShape = Nothing

    'close form
    Unload Me
    Exit Sub

    ErrorHandler:
    If Err.Number <> CancelErr Then
    MsgBox Err.Number & " " & Err.Description & vbCrLf _
    & "Sub: btnCopy"
    Err.Clear
    End If
    GoTo Exit_
    End Sub

  5. #5
    Dazzer is offline Senior Member Green Belt
    Join Date
    Sep 2003
    Posts
    103
    I think this solution is what I had in mind, it just depends how long it takes with 10,000+ shapes but I shouldn't think it would take that long.

    The mif/mid exporter is interesting I'll have a look at this as well, could be useful for something else.

    Thanks both for your help

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copying from MP2002 to Word 2002
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-27-2005, 04:35 PM
  2. problems copying map legends
    By jjn27 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-03-2005, 12:02 AM
  3. Copying the legend to paint or MS PowerPoint
    By jdfreese in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-20-2004, 05:39 PM
  4. Copying Worksheet with Combo Box
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-20-2004, 05:13 PM
  5. Copying location from one map to another in code.
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-09-2004, 10:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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