MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Mappoint and Access Driving time

This is a discussion on Mappoint and Access Driving time within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello all Thanks in advance Hello, I have an access database that is used for scheduling audits. What i would ...


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 (3) Thread Tools Display Modes
  3 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-23-2007
Junior Member
White Belt
 
Join Date: Jan 2007
Posts: 3
Mappoint and Access Driving time

Hello all

Thanks in advance

Hello,
I have an access database that is used for scheduling audits. What i would like to do is get the driving time from the auditors house to the location of the audit.

I have a query returning available auditors and their address[qry_USEABLE_REPS_forSTATE]
I also have a query returning the address for the PDN(primary dealer) that was selected [qry_dlr#-and-drive-time].

What i want to do is calculate the driving time between the two locations

Exp.
When i run [qry_USEABLE_REPS_forSTATE] i will get this:
Rep Address City State Zip
rep1 247 dayton rd dawson pa 15428
rep2 287 rough drive cranberry pa 16066
rep3 124 juniper drive butler pa 16066

When i run [qry_dlr#-and-drive-time] i will get.
PDN Dealer Name Address city state zip
12345 John howard 216 dear st erie pa 16507


What i want to do is run a loop that looks at the first rep in [qry_useable_reps_forstate] and calculates driving distance to the dealer location in [qry_dlr#-and-drive-time]

After it looks at the first rep it returns a drivetime for rep1
then goes to rep2 and so on


I want to return the results to the form so that i can see how long it takes each rep to get to the dealer


Is this possible?

thanks
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 01-24-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Mappoint and Access Driving time

Hi,

You have to look at FindPlaceResults or FindAddressResults method which returns Location objects for the addresses. Then you can add Waypoint objects to the Route object. Eventually set DriverProfile and other properties. After you call the Calculate method the drivingtime and other properties are calculated.
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 01-24-2007
Junior Member
White Belt
 
Join Date: Jan 2007
Posts: 3
Re: Mappoint and Access Driving time

That is confusing. Do you have any examples of how the code should look?

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 01-25-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Mappoint and Access Driving time

Hi,

Here is quick example in c#.

Code:
    FindResults results = MP.ActiveMap.FindAddressResults(street, city, "", "", zip, "");
    if (results.ResultsQuality == GeoFindResultsQuality.geoFirstResultGood) {
	Route route = MP.ActiveMap.ActiveRoute;
	route.Clear();

	// set first point
	object o = 1;
	Location loc = (Location)results.get_Item(ref o);
	Waypoint wp = route.Waypoints.Add(loc, loc.Name);
	wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;

	results = MP.ActiveMap.FindAddressResults(street2, city2, "", "", zip2, "");
	if (results.ResultsQuality == GeoFindResultsQuality.geoFirstResultGood) {
	    // set last point
	    o = 1;
	    loc = (Location)results.get_Item(ref o);
	    wp = route.Waypoints.Add(loc, loc.Name);
	    wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;

	    // set preferred roads
	    route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadArterial, 0.1);
	    route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadFerry, 0.1);
	    route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadInterstate, 0.9);
	    route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadOtherHighway, 0.6);
	    route.DriverProfile.set_PreferredRoads(GeoRoadType.geoRoadToll, 0.2);

	    // set preferred speeds
	    route.DriverProfile.set_Speed(GeoRoadType.geoRoadArterial, 50);
	    route.DriverProfile.set_Speed(GeoRoadType.geoRoadInterstate, 120);
	    route.DriverProfile.set_Speed(GeoRoadType.geoRoadLimitedAccess, 120);
	    route.DriverProfile.set_Speed(GeoRoadType.geoRoadOtherHighway, 90);
	    route.DriverProfile.set_Speed(GeoRoadType.geoRoadStreet, 50);

	    route.DriverProfile.StartTime = System.DateTime.Now;
	    route.Calculate();

	    Console.WriteLine("Minutes " + route.TripTime * 1440);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 01-29-2007
Junior Member
White Belt
 
Join Date: Jan 2007
Posts: 3
Re: Mappoint and Access Driving time

Ok I don't know why this is not working. It looks fine to me

For now all i am trying to do is put the drive time into a text box

Code:
Private Sub Command2_Click()
    'Define variables to hold our information.
    Dim oApp As Object, omap As Object
    Dim oPush(1 To 2) As Object
    Dim oloc As Object
    Dim oLOCtwo As Object
    Set oApp = CreateObject("Mappoint.Application")
    Set omap = oApp.NewMap  'Create a new map
    
    Set oloc = omap.Find("247 davis road" & " , " & Dawson & " , " & PA & ", " & 15428) 'Geocode the first address
    If Not oloc Is Nothing Then      'Check to see if the first address was found.
        Set oPush(1) = omap.AddPushpin(oloc) 'Place a pushpin on the map
        oPush(1).GoTo               'Go to that pushpin
    
    Set oLOCtwo = omap.Find("1801 Trenton Ct" & " , " & "Cranberry Twp" & " , " & PA & " , " & 16066)  'Geocode the second address
        If Not oLOCtwo Is Nothing Then 'Check to see if the second address was found
        Set oPush(2) = omap.AddPushpin(oLOCtwo) 'Add a pushpin for it
        oPush(2).Highlight = True
        
            With omap.ActiveRoute       'Let's generate some directions between the points
                omap.Waypoints.Add oloc  'Add the first address
                omap.Waypoints.Add oLOCtwo  'Add the second address
                omap.ActiveRoute.Calculate      'Now find the directions between them
            End With
            
Me.Text0 = Console.WriteLine("Minutes " + omap.ActiveRoute.TripTime * 1440)
        Else                'If the second location is not found, then indicate no directions
            Me.Text0.SetFocus
            Me.Text0.text = "No second location found!"
        End If
            
    Set omap = Nothing
    Set oApp = Nothing
    End If
End Sub

Any ideas

Last edited by Wilfried; 01-29-2007 at 03:40 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 01-29-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Mappoint and Access Driving time

Hi,

I have edit your post and put the code into [ code ] tags. Please do so in future because to make it more readable.

Please tell me (before I further investigate) what exacly is *not* working ?
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
access, driving, mappoint, time


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/mappoint-access-driving-time-5608.html

Posted By For Type Date
Using MapPoint from Word, Access and Excel - MapPoint Articles - MP2K Magazine This thread Refback 01-24-2007 01:01 PM
Companies - MP2K Magazine This thread Refback 01-23-2007 05:30 PM
MapPoint Help - MP2K Magazine This thread Refback 01-23-2007 11:26 AM

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
Driving Directions garon5 MapPoint 2006/2009 Discussion 0 12-25-2006 10:07 AM
Driving time between each waypoint Anonymous MapPoint 2006/2009 Discussion 1 05-10-2005 06:42 AM
driving directions impala454 MapPoint 2006/2009 Discussion 1 12-11-2004 10:49 AM
Set average driving speed in Mappoint WebService Anonymous MapPoint Web Service and Virtual Earth 1 06-01-2004 07:57 AM
Driving Day - How to turn off? Clive2004 MapPoint 2006/2009 Discussion 1 01-06-2004 06:42 AM


All times are GMT -5. The time now is 05:06 PM.


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