How do i not show alternative routes through google map - google-maps

I have tried like this but still i am not getting..
https://www.google.com/maps/dir/?api=1&origin=28.7041,77.1025&destination=25.5941,85.1376&travelmode=driving&alternatives-parameter=false
I guess, I am missing some parameters

Control of alternate routes is only (currently) available in the Google Maps Javascript API v3 DirectionsService and in the Directions Web Service.
Directions API
DirectionsService

Related

Google Maps JavaScript API throws "ExpiredKeyMapError" when Geocoding API is enabled

I use Google Maps JavaScript API for the map related matters and about to use Google Geocoding API to reverse the lat and lng to formatted address while users click on the map.
Everything works smoothly while I only use Maps JavaScript API until I enabled the Geocoding API. When I refreshed my page, I received error: Google Maps JavaScript API error: ExpiredKeyMapError.
To fix it is easy, simply disabled the Geocoding API fixed and apparently I can't use any features in Geocoding API anymore.
I also tried to generate a new API key and waited more than 2 hours but the problem is still there.
This is how I load the API and services
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&libraries=geocoding,places"></script>
How to properly use Maps JavaScript API and Geocoding API together?
Geocoding code to get address from lat and lng
var latLngToAddress = function (lat, lng) {
var latLng = {lat: lat, lng: lng},
geocoder = new google.maps.Geocoder;
geocoder.geocode(
{location: latLng},
function (results, status) {
console.log(results);
}
);
};
I get error Geocoding Service: This API project is not authorized to use this API. for doing above. If I enable the Geocoding service, then everything goes back to the original quesntion - the JS API will receive error ExpiredKeyMapError
I cannot guarantee the solution always work but this is how I solved it.
Disable the Geocoding API
Visit a Geocoding API request such as https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY and receive error.
Enable the Geocoding API within the project.
Visit a Geocoding API request again such as https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY and receive success.
Refresh the project page and both JavaScript and Geocoding APIs work smoothly now.
https://developers.google.com/maps/documentation/javascript/libraries
geocoding is not one of the available libraries in Google Maps Javascript API v3.
The API you have enabled is the Geocoding Web Service. You don't need it within a JS API project. To geocode/reverse geocode, simply use the google.maps.Geocoder class.
Here is my solution to my question and this solution is not guaranteed to work in many other cases.
Disable the Geocoding API
Visit a Geocoding API request such as https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY and receive error.
Enable the Geocoding API within the project.
Visit a Geocoding API request again such as https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY and receive success.
Refresh the project page and both JavaScript and Geocoding APIs work smoothly now.
Simply you need to disable the API and again Enable it within your project before using it and refresh all your work again.

Google Map Rates/Charges

google map pricing is highly complex. Can someone tell whether the follow will be considered as three map accesses counted for charging. I am using Javascript APIs and render maps on a mobile web app.
showing a map in the client
Geocode an address
Add a marker on the map for the given location
Reference: https://developers.google.com/maps/billing/understanding-cost-of-use
showing a map in the client using the Google Maps Javascript API v3 is a "Dynamic Maps" load (requires loading the API)
Geocode an address is a "Geocoding" access
Add a marker on the map for the given location doesn't use any additional quota

How to get the same result of google maps using google places api

I have to implement a restaurant location service by using the google places api like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=43.7666321,11.2546258&rankby=distance&type=restaurant&key=[API_KEY]
but the result are very different from the near by search using google maps:
https://www.google.it/maps/search/Ristoranti/#43.7666321,11.2546258,15z/data=!4m8!2m7!3m6!1sRistoranti!2sPlaza+Hotel+Lucchesi,+Lungarno+della+Zecca+Vecchia,+38,+50122+Firenze!3s0x132a53f8014b2cd1:0xe324c61f3f21ebce!4m2!1d11.2633806!2d43.7666092?hl=it
I've also tried the Radar Search Request but it doesn't work either.
You can use google map PlacesService.
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
For more details on parameter and how to use it,
Check: https://developers.google.com/maps/documentation/javascript/places

Is it possible to get multiple routes available between 2 places using google map api v3

I am new to Google map API and Phonegap. I am trying to create an app which will show the possible routes between the origin and destiny.
So is it possible to get multiple routes with direction using Google map API.
Is there any other API apart from Google which will provide me the multiple route. Thanks in advance.
The DirectionsRequest query has a boolean parameter provideRouteAlternatives that returns alternate routes in the DirectionsResult object.
Here is the documentation on working with the Directions Service:

How to get locations of Google Maps Route?

How I can get coordinates (lat,lon) of route from url generated by google (like: http://goo.gl/maps/1gpxk).
Is there an API for that or anything else?
Thanks.
See the documentation. Make sure you read the Terms of Service.
Directions Web service
Google Maps Javascript API v3 Directions Service