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
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 ...
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
Hi,
You can use Distance or DistanceTo methods.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
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
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
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 ?
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
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
Hi,
I understeand, thanks for clarify. I think with maritime distance it will be the same problem as for rail distance.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
There are currently 1 users browsing this thread. (0 members and 1 guests)