Plotting route between 2 points in android - android

I want to draw path from one location to other location. How to plot the path between the two locations. I have coordinates(latitude,longitude) for both locations. How can i achieve this functionality? I am working on android sdk 2.2 . I don't want to use kml.

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?saddr="+ latitude + "," + Longitude+ "&daddr="+latitudeDb+","+longitudeDb+""));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);
You Can Use Following Intent and pass Your Source and destination latitude and longitude ,and
Next Actvity shows Path Between your geo points.

Perhaps this will server your need (from google) - http://code.google.com/apis/maps/documentation/javascript/

Related

How to add marker to a specific location in Google Maps in Android Studio?

I have created a button which takes the user to a specific location on Google Maps. Here is the snippet:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
However, the Map merely zooms to the particular location without adding a marker to the co-ordinates I have put. Can someone please help me?
Thank You.
This works for me (the 'hellothere' is a label you can replace or remove):
String uri = String.format(Locale.ENGLISH, "geo:0,0?q=%f,%f(hellothere)",latitude,longitude);
UPDATE: the geo: parameter can be 0,0 when supplying a location query.
(When testing you may want to close the Map app each test particularly if not moving the marker.)

Opening Google Maps for Android Navigation with multiple coordinates as waypoints

I want to know if this is possible or now.
Right now I am opening the Google Maps with navigation from current user location to a defined set of coordinates like this:
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + String.valueOf(getDestinationLatitude()) + "," + String.valueOf(getDestinationLongitude())));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.driveabout.app.NavigationActivity");
startActivity(intent);
Is it possible to to have multiple sets of coordinates between current location and a final destination, so go to point a, point b and then finally destination point c. ?
It is possible to have multiple waypoints along the way to a certain destination. This can be achieved by using the Directions API. This is the API that would also give you the legs[] and the steps[] array which helps you in properly implementing and returning probable paths from source to the destination covering all the waypoints along the way.
For a sample implementation, check this link.

How to check whether the Street view panaroma data is available or not for a particular Latitude and Longitude values

Well,
I m getting all nearby places via google places API. , I set markers to all my near by places. I am calling builten google Street view panorama via intent on click event of the infowindow like this.
String uri = "google.streetview:cbll=" + latitude + "," + longitude
+ "&cbp=1,99.56,,1,-5.27&mz=21";
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(uri));
startActivity(streetView);
note: I am passing the Latitude and longitude values in my URI
its working just fine. but the problem is that some times panorama viewer shows a Toast "StreetView is not available here" if the data is not available.
Question
So my question is that how can I check before starting my panorama viewer that whether a location with certain Latitude and Longitude values has the street view data available or not?
I m using google maps v2 for android

Path between two geopoints on android google maps view

I'm trying to get the path between two geo points on my android app, i don't need any driving directions - just path. What I've already found myself is to draw the straight line between two geopoints (http://djsolid.net/blog/android---draw-a-path-array-of-points-in-mapview). Is it possible to get the actual path? I mean path which I can really walk, road path - not just straight line between two geopoints without parsing the google maps web URL ?
I think the best solution is called android internal map activity to show route between two geo points. Please refer to the code below:
String uri = "http://maps.google.com/maps?saddr=" + currentLatitude+","+currentLongitude+"&daddr="+fixedLatitude+","+fixedLongitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
It's called built in map activity and draws a route path between current and fixed latitude and longitude.

Draw a route on a map (android)

Can i draw three route in my application(use google map api),i can draw a route with kml,
now i want to draw three different route between two points,such as foot, bike, bus and so
on.
String uri = "http://maps.google.com/maps?saddr=" + lat+","+lon+"&daddr="+lat1+","+lon1;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
I think this may help you.
Yes you can draw a route in Android on a map, you may want to start by saving your GPS points into a database.
You could also just use the Google Maps API to do this for you automatically.

Categories

Resources