MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Get Distance Function causes errors

This is a discussion on Get Distance Function causes errors within the Development forums, part of the MapPoint 2006/2009 Discussion category; Hey folks, So the online knowledge base articles I've come across don't quite fit my scenario... Perhaps someone else has ...


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

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



Click here to register

Reply

 

LinkBack (2) Thread Tools Display Modes
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 10-02-2008
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 16
Get Distance Function causes errors

Hey folks,

So the online knowledge base articles I've come across don't quite fit my scenario... Perhaps someone else has the same dilemma, or knwos how to remedy it.

I've written a function in Excel's VBA.
The purpose is to return the distance between two lat/long points. (If that point isn't near a road, the code refers to a straightline distance calculation that I've adapted named: "Posdist"...

When I fill my excel worksheet with multiple copies of this function, and have inputs pointing to appropriate cells, with latitude and longitude, after a certain time I get error messages... The kicker is it works when I calculate one cell at a time, but when I recalculate the whole sheet I get errors...

They read:
This application is unable to continue running due to an internal error (6-40028--1073741819)
Error signature
AppName: mappoint.exe
Appvers:13.0.15.2800
Modname:ntdll.dll
mod version:5.1.2600.2180
Offset: 00010f29

I tried uninstalling the network HP printer we have in the office, and unplugging the network cable, and then got a slightly different error:
with details:
Modname:mfc71.dll

Here's my snippet of code, for your perusal:
hopefully someone has a clue as to my next appropriate step of actio!

Thnx in advance,
andriy

Code:
--- the PCFLAG input, is binary, and identifies isolated postal codes, so teh algorithm directly calculates distance based on straightline distance)

Public Function RoadDistance(PCFlag, Lat1, Long1, Lat2, Long2)

Dim SysApp As New MapPoint.Application
Dim SysMap As MapPoint.Map
Dim SysRoute As MapPoint.Route
Dim SysLoc1 As MapPoint.Location
Dim SysLoc2 As MapPoint.Location

If PCFlag = 1 Then
GoTo Straight
End If

Application.ActivateMicrosoftApp xlMicrosoftMappointNorthAmerica

Application.DisplayAlerts = False

Set SysMap = SysApp.ActiveMap
Set SysRoute = SysMap.ActiveRoute

SysApp.Units = 1

Set SysLoc1 = SysMap.GetLocation(Lat1, Long1)
Set SysLoc2 = SysMap.GetLocation(Lat2, Long2)

SysRoute.Waypoints.Add SysLoc1
SysRoute.Waypoints.Add SysLoc2

On Error GoTo IsolatedPC
SysRoute.Calculate

RoadDistance = SysRoute.DrivingTime
SysRoute.Clear
SysMap.Saved = True
GoTo Ending

IsolatedPC:
SysRoute.Clear
SysMap.Saved = True
Straight:
RoadDistance = Posdist(Lat1, Long1, Lat2, Long2)
Ending:

End Function


any ideas?
anyone?
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 10-06-2008
Junior Member
Yellow Belt
 
Join Date: Mar 2007
Posts: 16
Re: Get Distance Function causes errors

Doesn't anybody else use mappoint to calculate distances between ZipCodes for an entire dataset of locations?

Do you folks usually do this in C++? Is my problem that I'm doing it in VBA?

thanks for your input...

andriy
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 10-06-2008
Winwaed's Avatar
Mapping-Tools.com
Black Belt
 
Join Date: Feb 2004
Posts: 1,142
Blog Entries: 22
Re: Get Distance Function causes errors

<cheeky answer>

I sell my own products that do this.

The one that works from database (or Excel) route listings uses C#.

Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
See the Geoweb Guru for online mapping
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
calculate, distance, errors, excel, function


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/get-distance-function-causes-errors-8759.html

Posted By For Type Date
Reverse Geocoding with MapPoint 2002 - MapPoint Articles - MP2K Magazine This thread Refback 10-03-2008 02:19 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 10-02-2008 02:56 PM

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
Help errors spirido MapPoint 2006/2009 Discussion 2 05-07-2004 08:30 AM
Garmin StreetPilot III data errors jalesse MapPoint 2006/2009 Discussion 0 12-31-2003 11:22 PM
Does the distance function btw 2 locations get correct # spideybud MapPoint 2006/2009 Discussion 2 12-16-2003 05:15 PM
Map location errors in Ireland. Anonymous MapPoint 2006/2009 Discussion 1 07-30-2003 08:34 PM
Random not ready errors ToddRCS MapPoint 2006/2009 Discussion 3 11-14-2002 06:31 PM


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


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Server is too busy




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