How do I add a custom route in android using google maps. I am building an app similar to mapmyhike. Is it possible in Maps API V3?
Consider looking into this link
A DirectionsRoute contains a single result from the specified origin
and destination. This route may consist of one or more legs (of type
DirectionsLeg) depending on whether any waypoints were specified.
[EDIT]
Google Maps Directions API v3 for Android provide routes in the Encoded Polyline Algorithm Format.
So you can try something as follows:
android-draw-route-map-between-two-geopoints
You can pass latitude and longitude to this to get route directions for two points
String uri = "http://maps.google.com/maps?saddr="+ latitude + "," + longitude + "&daddr="+ latposition + ","+lngposition;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity").addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);
Related
I am already done push pin on bing map but the issue is more than 100 push pin is not visible on bing map. I have REST api and I am getting data from api and fetch longitude and latitude on map. By the REST api push pin on map is working fine.
But more than 100 pins are not showing on map.
Is that any limitation for Bing map to allow less than push pins are showing ?
I'm assuming you're using the static map API although you didn't provide any sample code or explicitly list which API you were using.
If you check the documentation here under the "pushpin limits" section:
https://msdn.microsoft.com/en-us/library/ff701724.aspx?f=255&MSPPError=-2147217396
The static maps API only supports 18 pushpins if passed through the URL, or 100 pushpins if passed via POST. This is for performance and practical reasons - more than 100 pins on a small static map would just cover the whole image.
If you want to display more pushpins, you should use the interactive map control, not the static map API.
https://msdn.microsoft.com/en-us/library/mt712542.aspx
I am in the process of creating an app using the Google Maps api to generate random biking routes (http://sutsurikeru.com/maps) and it works fine so far, but the issue I am having is passing the generated route, including the following info to the google maps app:
Start Destination
Way-point (randomly generated using https://gis.stackexchange.com/questions/25877/how-to-generate-random-locations-nearby-my-location)
End Destination (same as the start destination)
Once I've got all the lat/long information I pass it to a button that is created when the route is generated so that it can pass the route to the Google Maps App, but I am unsure how to pass the way-point as there is no mention of it in the docs - https://developers.google.com/maps/documentation/ios-sdk/urlscheme
$('#goRide').append('<a class="goridebtn" href="comgooglemaps://?saddr=' + address + '&daddr=' + address + '&directionsmode=bicycling">Go ride</a>');
I guess my question is then, can I include the way-point information when I am passing it to the Google Maps App?
i couldn't find the answer for that too , so i ended using:
"comgooglemapsurl" instead..
this way you can pass a full url (same onese used in the browser)
the format will be something like this:
comgooglemapsurl://www.google.com/maps/dir/STARTING_POINT/WAYPOINT_1/WAYPOINT_2/WAYPOINT_3/WAYPOINT_4/DESTINATION
you can add as many points as u wish
comgooglemapsurl://www.google.com/maps/dir/24.848607,46.660478/24.748607,46.760478/24.778607,46.784478
https://developers.google.com/maps/documentation/urls/ios-urlscheme
Looks like you can add waypoints using the +to: variable inside the daddr text. The following example shows this in use:
comgooglemapsurl://?saddr=55.852866,-4.323120&daddr=56.019015,-3.372803+to:55.972934,-3.279419+to:55.932952,-3.284912+to:56.022085,-3.565063
i want to make multiple Markers google map by address or pincode like
i just add address or pincode in array and i will made multiple marker google map
for example
var address = new Array('Canada','Newyourk')
or may be pincode
var address = new Array('123456','654321')
my basic is html and javascript
That's done using Geocoding service of the API. More on this topis here: https://developers.google.com/maps/documentation/javascript/geocoding and here: https://developers.google.com/maps/faq#geocoder_exists.
I also advice you to read the whole API documentation. It's one the best API documentations out there with lots of useful examples and guides.
I need to calculate the distance between two addresses and I don't need a map view or anything graphical.
I simply want the user to type in the address (end location is defined by myself) and let the javascript calculate the distance between the two points.
However I don't find a way to send an address string and get the GPS-coordinates from it using the Google Maps API.
(I really only need the two GPS points, the distance calculation is trivial.)
What you are trying to do is called geocoding. It is possible with the Maps API. See the Geocoding section for more details. This is the basic idea:
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
"address": inputAddress
}, function(results) {
console.log(results[0].geometry.location); //LatLng
});
However, you are limited to 2500 geocoding requests a day, and what you are trying to do is against the terms of use:
Note: the Geocoding API may only be used in conjunction with a Google
map; geocoding results without displaying them on a map is prohibited.
This page describes a Google JSON service that you can extract gps coordinates from. I think this would also be under the "No Use of Content without a Google Map" in the TOS.
This is possible. See below link
http://briancray.com/posts/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api
Loving Google Maps API V3, but having difficulty in getting accurate driving directions and manipulating the destination address displayed when using DirectionsRenderer.
Regardless if I pass an address string or a latLng instance as the destination to DirectionsService, when I use the DirectionsRenderer to output step-by-step directions, the destination text is always the geocoded result of my original destination (i.e. the address, rather than COMPANY NAME).
Ideally, I want to pass a precise latLng destination to DirectionsService, but control the text displayed as the 'destination'.
I guess I could manually output the HTML, but part lazy, part not wanting to re-invent the wheel, would prefer to use DirectionsRenderer.
Any ideas?
You may use:
response.routes[0].legs[0].end_address="Company";
before calling
directionsDisplay.setDirections(response);