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

add two waypoints and calculate route with Delphi

This is a discussion on add two waypoints and calculate route with Delphi within the MapPoint Desktop Discussion forums, part of the Map Forums category; I would like some sample code in Delphi to Add two route waypoints and calculate the route. I have seen ...

  1. #1
    jmiller55 is offline Junior Member White Belt
    Join Date
    Jun 2003
    Posts
    8

    add two waypoints and calculate route with Delphi

    I would like some sample code in Delphi to Add two route waypoints and calculate the route. I have seen a couple of samples but can't get it to work. Please post the complete procedure including the Var section, I am new to MapPoint.
    Jim

  2. #2
    rbarthels is offline Member Green Belt
    Join Date
    Nov 2002
    Posts
    52
    Perhaps this helps:

    procedure CalculateDistance(dblLonFrom:double; dblLatFrom:double; dblLonTo:double; dblLatTo:double;var KM:double; var ZEIT:double);
    var
    aFromLocation:Location;
    aToLocation:Location;
    aRoute: Route;
    begin
    if (MPApplication=NIL) then
    exit;

    aFromLocation:=MPApplication.ActiveMap.GetLocation (dblLatFrom, dblLonFrom, 0.0);
    aToLocation:=MPApplication.ActiveMap.GetLocation(d blLatTo, dblLonTo, 0.0);

    Screen.Cursor := crHourGlass;

    aRoute:=MPApplication.ActiveMap.ActiveRoute;
    aRoute.Clear;
    aRoute.Waypoints.Add(aFromLocation,'S');
    aRoute.Waypoints.Add(aToLocation,'E');

    aRoute.Calculate;

    KM:=aRoute.Distance;
    Zeit:=aRoute.DrivingTime;

    Screen.Cursor := crDefault;
    end;

  3. #3
    jmiller55 is offline Junior Member White Belt
    Join Date
    Jun 2003
    Posts
    8

    Thanks, sample using street address's?

    Thank you for the reply. Using Lat and Long. works perfectly. Do you have an example using street addresses?
    Jim

  4. #4
    rbarthels is offline Member Green Belt
    Join Date
    Nov 2002
    Posts
    52
    I wrote my own geocoding routines by using FindAddress, because I found the results of FindAddress sometimes very bad. You can download the program for geocoding from MP-magazine.

    Then I put the coordinates in my database and make distance calculations this way.

    So I didn't have a simple example.

    Rainer

  5. #5
    jmiller55 is offline Junior Member White Belt
    Join Date
    Jun 2003
    Posts
    8

    MapPoint Route with Delphi

    Rainer: I have the route working. Thanks to your help, I had the information I needed to do the rest of it.
    Regards,
    Jim

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Generate intermediate waypoints from a route - how?
    By Gizz in forum Bing Maps and MapPoint Web Service
    Replies: 3
    Last Post: 07-09-2007, 07:23 AM
  2. Delete Numerator from waypoints when i draw a route
    By Genamo in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-23-2006, 03:18 AM
  3. How to hide waypoints in a route?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-06-2004, 08:46 AM
  4. How do I calculate a route distance without displaying route
    By spideybud in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 09-09-2003, 10:14 AM
  5. Converting a route to waypoints
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-04-2003, 12:27 PM

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