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 7 of 7

As the crows flies and rail

This is a discussion on As the crows flies and rail within the MapPoint Desktop Discussion forums, part of the Map Forums category; MapPoint is a very nice tool to find road distances between two cities. Is there any way to do the ...

  1. #1
    Well is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Montreal
    Posts
    11

    Question As the crows flies and rail

    MapPoint is a very nice tool to find road distances between two cities.

    Is there any way to do the same things with railway or as the crows flies distances?

    Thanks for your help

    A. Ouellet


  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: As the crows flies and rail

    Hi,

    You can use Distance or DistanceTo methods.

  3. #3
    Well is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Montreal
    Posts
    11

    Re: As the crows flies and rail

    Hi Wilfred and everybody,

    I succeed to find route and as the crow flies distances between two cities. However, I haven't any idea on how to find railway distance. I possibly also need to find maritime distance between two ports. Is there a way to do that?


    Thanks a lot,

    A. Ouellet

    P.S: I am a french Canadian. I am sorry for all possible English mistakes

  4. #4
    Well is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Montreal
    Posts
    11

    Re: As the crows flies and rail

    I just forgot. Here is the code I use. It work good.

    A. Ouellet

    Private Sub CommandButton1_Click()
    Dim oApp As MapPoint.Application
    Dim objMap As MapPoint.Map
    Dim objLocOne As MapPoint.Location
    Dim objLocTwo As MapPoint.Location
    Dim objRoute As Route
    Dim LocOne As String
    Dim LocTwo As String
    Dim sFileName As String
    Dim Distance As Long
    Dim i As Integer

    Set oApp = CreateObject("MapPoint.Application.NA.11")
    Set objMap = oApp.NewMap
    Set objRoute = objMap.ActiveRoute

    i = 3
    Do Until Cells(i, 1) = 0
    'As the crow flies
    LocOne = Cells(i, 1)
    LocTwo = Cells(i, 2)
    Set objLocOne = objMap.FindResults(LocOne).Item(1)
    Set objLocTwo = objMap.FindResults(LocTwo).Item(1)
    objMap.AddPushpin objLocOne
    objMap.AddPushpin objLocTwo
    Distance = objMap.Distance(objLocOne, objLocTwo)
    Cells(i, 3) = Distance
    Cells(i, 4) = Distance * 1.609344 'km

    'Route distances
    objRoute.Waypoints.Add objMap.FindResults(LocOne).Item(1)
    objRoute.Waypoints.Add objMap.FindResults(LocTwo).Item(1)
    objRoute.Calculate

    Distance = objRoute.Distance
    Cells(i, 5) = Distance
    Cells(i, 6) = Distance * 1.609344 'km

    i = i + 1
    Loop

    'Insert map in Excel
    objMap.DataSets.ZoomTo 'Zoom sur la map
    sFileName = "\\Exchange-srv\Alexandre\Recherche\MapPoint\Map.ptm"
    objMap.SaveAs sFileName
    ActiveSheet.OLEObjects.Add(Filename:=sFileName, Link:=False,_ DisplayAsIcon:=False).Select

    End Sub

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: As the crows flies and rail

    Hi,

    For railway distance I think the only possible way is to put Location objects and calculate distance in segments.

    What exacly do you mean by 'maritime distance' ? Do you mean the distance in Nautical miles ?

  6. #6
    Well is offline Junior Member White Belt
    Join Date
    May 2007
    Location
    Montreal
    Posts
    11

    Re: As the crows flies and rail

    Hi Wilfried,

    For the railway distance, thatís what I though.

    By 'maritime distance', I mean distance between two ports in km. As a crow flies distance is a good approximation, but imprecise. For example, look at the way to get the Montreal port when coming from Europe.

    Thank you again,

    A. Ouellet

    P.S: Sorry again for english mistakes

  7. #7
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: As the crows flies and rail

    Hi,

    I understeand, thanks for clarify. I think with maritime distance it will be the same problem as for rail distance.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Distances 'as the crow flies'
    By TRK in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-20-2007, 04:25 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 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 55 56 57 58 59 60 61 62 63 64 65 66