Google Places API and Destination URL - google-maps

Is there a way to get a place's website through the google places API? For example, if I find a Barnes and Noble, is there a way for Google Places to return barnesandnoble.com in part of the xml/json response?

According to the current Places API documentation, the URL of the location is not one of the returnable values, so it cannot be retrieved using the API.
The url field returned is the URL of the Google Places page for the location, not the web site of the location itself.

Related

Generating a link to Google Maps from a directions API response

I currently have an application which takes a a start and end point from a user and sends a request to the google maps directions API, for example: https://maps.googleapis.com/maps/api/directions/xml?key=my_key8&origin=M460PU&destination=NN36NW&sensor=false&mode=driving&units=imperial&departure_time=1501752779
We then display the estimated journey time for a given route. The user has asked if it's possible for us to include a link directly to Google maps so that they can see the route on the maps and make sure it looks ok.
I've seen previous questions such as this one: Link to Google Maps but that seems to be a solution for a simple Google Maps search, where as in my case I want to see a route from the directions API.
I'm trying to figure out if I there's a way I can take the data from the Directions API response and plug that in to a http://maps.google.com/maps URL that the user can click on. Has anyone ever had any success doing this?
As mentioned #geocodezip you should use Google Maps JavaScript API or Google Static Maps API in order to show exactly the same route as the output of Directions API.
There is also an option to open Google Maps web site or native app using the Google Maps URLs. You can have a look at the documentation to figure out how to create the URL:
https://developers.google.com/maps/documentation/urls/guide#directions-action
The only issue is that the Google Maps URLs doesn't provide any parameter for departure time, so you will always get routes for "Leave now" that might have discrepancies comparing to a web service that was requested for a different departure time.
Based on your question I think the Google Maps URL might be
https://www.google.com/maps/dir/?api=1&origin=M460PU&destination=NN36NW&travelmode=driving

Google Maps URL Not Found

We have been using a Google Maps URL in order to get a route from two different sets of GPS coordinates.
URL:
http://maps.google.com/maps?output=dragdir&saddr=34.019283,-118.494286&daddr=34.021564,-118.490112
[Link]
We have been using this URL for months and this morning this URL is returning a 404 error. Is this URL the wrong way to retrieve a route from Google Maps?
That URL is the "classic" google maps. It might have been turned off. You will need to replace it using the Google Maps Embed API (or one of the other Google Maps APIs).

How do I get a direct link to a place on google maps with the Place Id

I have the Place Id of a place on google maps in my app. Is there a way to put the place Id in a URL and have it directly link to the page? Or does it have to be done through the URL?
I can't seem to find anything detailing this in the docs. I've tried below, but it just gets me the standard google maps page:
https://maps.google.com/maps?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4
Recently, in May 2017, Google launched the new Google Maps URLs API. You can read about this API in the official documentation
https://developers.google.com/maps/documentation/urls/guide
So, from now on you can construct a URL for Google Maps using the place ID. In your particular case this URL will be
https://www.google.com/maps/search/?api=1&query=Google&query_place_id=ChIJN1t_tDeuEmsRUsoyG83frY4
Hope this helps!
Not directly, using the placeID you can get a variety of information in JSON or XML format, among them there are also the lat lng of the place and its address with which you can easily locate the map
google developer doc
The URL for a specific Google Place is returned by the places details API endpoint.
If for example you query:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJV2BQ4laeekgRFauLvdXbFXE&key=YOUR_API_KEY
You will see that in the returned JSON there is a key 'url' which points to https://maps.google.com/?cid=8148660811851344661
The correct format, at this time, to produce a general link that goes directly to correct google place is: https://maps.google.com/?cid=[place_id]&t=[maptype]
The map type parameter "t" is apparently necessary. Without it, google maps seems to perform a more general search when the link opens that is sometimes successful and sometimes not. With it, maps opens to correct place each time whether it opens in browser or in app on mobile.
Set this parameter to "m" for a street map and "k" for a satellite map.
A lot of answers on SO show the following syntax which often pulls unwanted results if two locations of the same name are nearby e.g.:
https://www.google.com/maps/place/Starbucks/#43.088554,-88.06579,17z/
If you are already using google places api, then you have the place_id, so i recommend using it to avoid ambiguity.

Checking whether an address exists. Google Maps SDK iOS

Is there a way to check whether an address you pass into Google Maps to get direction with the URL scheme exists?
You could try making a geocode request, and then see if you get a response of OK (the address could be converted into a location, so it exists), or ZERO_RESULTS (the address doesn't exist). Presumably when you start the Google Maps app with a URL scheme, Google uses the same geocoder internally to look up the address.
https://developers.google.com/maps/documentation/geocoding/

Google Maps API Webservice usage in windows forms application

My requirement is this.I need to get the latitude and longitude for a given address using Google Maps API. I found in the Google Developers site the following web service which takes address as input and returns so much information of the given site which includes latitude and longitude also. I checked this by executing this URL in the browser.
Latitude and longitude information is coming under geometry/location section. I want to use this web service in windows based application and gets the latitude and longitude of different sites by passing different sites information to this web service each time in a loop.How can I do this?
Looks like you will have to either establish a static list of sites to iterate through them and modify the url accordingly or assemble the same url for the site that is requested by the user.
Also, you will need an XML parser:
http://msdn.microsoft.com/en-us/library/9d83k261.aspx