Question

I am working on the app for Android and iOS platforms. My client requires that the app has to have "add directions" functionality. Let's say I have a TO and FROM points set on my app, and I want to show the best route between these two points. If it's just these two points it's fine. There's plenty of resources on how to proceed. But if I want to add some extra directions, like GO THROUGH for example, the internet has no answers for me. If you could point me to any apps (have to use Google Maps) for mobile platforms, where this functionality is working it would be great. Maybe you have some sort of documentation or some other materials on the subject.

Thanks, Mike (poland)

Was it helpful?

Solution

try to format the uri like: from:50.74,14.00889+to:51.66444,17.85679+to:52.66444,17.85679 you can add as much +to terms as you want

edit: if you ar using the Map api, you supposed to have a code like thisone to calculate a route:

    StringBuilder urlString = new StringBuilder();
    urlString.append("http://maps.google.com/maps?f=d&hl=de");
    urlString.append("&saddr=");//from
    urlString.append( Double.toString((double)src.getLatitudeE6()/1.0E6 ));
    urlString.append(",");
    urlString.append( Double.toString((double)src.getLongitudeE6()/1.0E6 ));
    urlString.append("&daddr=");//to
    urlString.append( Double.toString((double)dest.getLatitudeE6()/1.0E6 ));
    urlString.append(",");
    urlString.append( Double.toString((double)dest.getLongitudeE6()/1.0E6 ));
    urlString.append("&ie=UTF8&0&om=0&output=kml");

you should be able to add some waypoints in the discribed format.

        urlString.append("+to:")
        urlString.append( Double.toString((double)waypoint.getLatitudeE6()/1.0E6 ));
        urlString.append(",");
        urlString.append( Double.toString((double)waypoint.getLongitudeE6()/1.0E6 ));

OTHER TIPS

The google maps api v3 has a directions rederer. You can render a pollyline between two points and have the pollyline be dragable i.e. you can pick a pint along the route and reposition it as a waypoint. see the api documentation.

alternativly you can capture click events on the map add push the location into an array of stopovers to pass on the the routing request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top