×

Discussion Board

Results 1 to 6 of 6

Hybrid View

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    6

    get distance the route?

    hi friends..

    I make an application routing but I can not display the distance of the routing
    how to display distance the route?

    Thank you

  2. #2
    Nokia Developer Expert
    Join Date
    Oct 2007
    Posts
    441

    Re: get distance the route?

    hi

    do you mean you need distance calculation between two geo-points (Latitude, Longitude) or just displaying the route?

  3. #3
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    289

    Re: get distance the route?

    To obtain the length of a route use: Route.getSummary().getDistance(), to get an "as-the-crow-flies" distance you can use Route.getStart().getMappedPosition().distanceTo(Route.getEnd().getMappedPosition())

  4. #4
    Registered User
    Join Date
    May 2012
    Posts
    6

    Re: get distance the route?

    Quote Originally Posted by jasfox View Post
    To obtain the length of a route use: Route.getSummary().getDistance(), to get an "as-the-crow-flies" distance you can use Route.getStart().getMappedPosition().distanceTo(Route.getEnd().getMappedPosition())
    where I should put the code above?

    this is my code
    Code:
    public void onRequestComplete(RouteRequest request, Route[] routes) {
    
               map.removeAllMapObjects();
               this.routes = routes;
               for (int i = 0; i < routes.length; i++) {
               map.addMapObject(
               mapFactory.createMapPolyline(routes[i].getShape(), 3));
               map.setCenter(routes[i].getStart().getMappedPosition());
    }
    
            progressEnd();
    }

  5. #5
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    289

    Re: get distance the route?

    Something like this:

    Code:
    public void onRequestComplete(RouteRequest request, Route[] routes) {
    
            map.removeAllMapObjects();
            this.routes = routes;
            for (int i = 0; i < routes.length; i++) {
                map.addMapObject(
                        mapFactory.createMapPolyline(routes[i].getShape(), 3));
                map.setCenter(routes[i].getStart().getMappedPosition());
    
                System.out.println(" THE CROW FLIES : " + routes[i].getStart().getMappedPosition().distanceTo(routes[i].getDestination().getMappedPosition()));
                System.out.println(" THE DRIVER GOES: " + routes[i].getSummary().getDistance());
            }
    
        }

  6. #6
    Registered User
    Join Date
    May 2012
    Posts
    6

    Re: get distance the route?

    Quote Originally Posted by izinin View Post
    hi

    do you mean you need distance calculation between two geo-points (Latitude, Longitude) or just displaying the route?
    I need distance calculation between two geo-points

Similar Threads

  1. Route Map is not working...
    By Ulala in forum [Archived] Maps API for Javascript
    Replies: 6
    Last Post: 2012-03-19, 20:12
  2. Nokia MAP : Route distance
    By binooetomo in forum [Archived] Maps API for Javascript
    Replies: 5
    Last Post: 2011-12-21, 06:44
  3. route and record route on 3rd edition
    By jcaradec in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2007-04-16, 19:07
  4. Record-Route and Route at SIP
    By mhappenhofer in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-11-30, 09:22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×