MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Newbie needs help calculating distance

This is a discussion on Newbie needs help calculating distance within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello all. I stumbled across this forum while looking for MapPoint help on the web. I am trying to come ...


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 11-16-2005
Junior Member
White Belt
 
Join Date: Nov 2005
Posts: 1
Newbie needs help calculating distance

Hello all. I stumbled across this forum while looking for MapPoint help on the web. I am trying to come up with a way to access MapPoint (2001) via a function in an Excel module and calculate the distance between locations in two different cells. I can use the Distance method in conjunction with GetLocation method only if I start with lat,long,alt. Problem is, I want to use city,state,country and this seems to require the Find method. Is there a way to work around this? Thanks for any ideas that you can offer. Here is a general idea. strPoint1 and strPoint2 will eventually be Excel cell addresses. Thanks, Tom

Function StraightLineDist(strPoint1, strPoint2)
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc(1 To 4) As MapPoint.Location

Dim dblDistance As Double

Set objMap = objApp.NewMap

'Get two known locations
Set objLoc(3) = objMap.Find("Seattle, WA, United States") 'Seattle, WA
Set objLoc(4) = objMap.Find("Redmond, WA, United States") 'Redmond, WA

Set objLoc(1) = objMap.GetLocation(47.75399, -121.97436, 100) 'Seattle, WA
Set objLoc(2) = objMap.GetLocation(47.6779, -122.11032, 100) 'Redmond, WA

'Retrieve the distance
StraightLineDist = objMap.Distance(objLoc(1), objLoc(2))

End Function
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 11-17-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

This article http://www.mp2kmag.com/articles.asp?...xtract.lat.lon describes how to calculate coordinates from a location object. I think this is what you need.
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
calculating, distance, newbie


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
Calculating travel time between two locations Anonymous MapPoint 2006/2009 Discussion 3 08-04-2003 02:47 PM
Calculating distances from a route Anonymous MapPoint 2006/2009 Discussion 0 07-18-2003 12:23 PM
Calculating distance without direction-list rbarthels MapPoint 2006/2009 Discussion 0 05-13-2003 10:57 AM
Calculating Distances For Dummies Anonymous MapPoint 2006/2009 Discussion 0 12-20-2002 06:26 PM
Trouble calculating distances Anonymous MapPoint 2006/2009 Discussion 0 10-03-2002 12:15 PM


All times are GMT -5. The time now is 05:09 AM.


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