I want to set paths on a Google maps. I’ve done some coding and able to draw single paths on a Google map. I want to know if there is any method to accomplish my objective. How can I do this?
want to show multiple paths between two Geo coordinators.
I’m new to this and can you please help me to do this. Thank you.
try this
String uri = "http://maps.google.com/maps?saddr=" + (srcLocation.getLatitude())+","+(srcLocation.getLongitude())+"&daddr="+destLat+","+destLon;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
Draw route using this. This is for one route.
Related
I want to draw a path on map between known points(lat, long) using:
String uri = "http://maps.google.com/maps?f=d&hl=en&saddr="+source_latitude+","+source_longitude+"&daddr="+destination_latitude+","+destination_longitude;
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);
But instead of just drawing route, Google Maps shows menu Car/Bus/By foot, trying to make a route from my current location to those points. What am I doing wrong? Is it still possible to draw route on map using the method above?
By running this intent you are basically opening an "outside" application - Google Maps that is not related to your application. the behavior you are receiving is the behavior that should be for the version of Google Maps you have in your phone. You can't edit the way it behaves, only the things that you are allowed to change using the settings screen of this application.
You have to parse the xml or json that your are using in the url in an Asynctask class and draw it on the map.
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.
I have a small problem, I need to develop an application that shows the route of public transport, I found tutorials about route of cars.
I saw this example:http://maps.google.com/maps?f=d&hl=en&saddr=25.04202,121.534761&daddr=25.05202,121.554761&ie=UTF8&0&om=0&output=kml
and tried to add dirflg = & rB the URL to show the public transport but server responded with the empty kml.
Does anyone know how to help me?
assuming that you are asking this for android, you can use the following intent
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345")); startActivity(intent);
where saddr and daddr are starting and destination address's location coordinates.
same has been discussed in several threads already
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.
I have read a lot of stuff about launching Google Maps in Android.
That's pretty easy:
Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
startActivity(it);
The problem is that the map is shown at a high zoom level and there is no marker on the map.
So, if the user move a little bit or something happen, the point is lost.
Is that possible to add a marker like this:
http://img.skitch.com/20100820-da3n4r7h5xbsu6bsx4p4ujjghc.jpg
or like this:
http://img.skitch.com/20100820-qg7k2m5wtwm3j5phphrgc8tb53.jpg
So i can be sure that even if the user move the map, he will be able to find this place again.
Thank a lot for any help.
The geo: scheme can take a zoom level:
geo:latitude,longitude?z=zoom
but as far as I know, you can't specify a marker in the intent.
If you use this mode of the geo: scheme, it might give you what you want:
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city
Seem that the correct answer is no, and I have currently no workaround...