Generate or Obtain Google Maps Short "goo.gl/maps..." URL - google-maps

For a single location I can obtain the,
Long URL: https://www.google.com/maps/place/Kato+Restaurant/#34.0418978,-118.4633402,17z/data=!3m1!4b1!4m5!3m4!1s0x80c2bb684a20dd9d:0xa5a8ac9b5becd509!8m2!3d34.0419011!4d-118.4611438?hl=en-US
Web Provided Short URL: https://g.page/katorestaurant?share
Desired Short URL: https://goo.gl/maps/rVNsYdoULhhwKBY88 (Generated by Google Maps iOS app)
The API only provides the CID based URL: https://maps.google.com/?cid=11936980595607655689, which I'm not looking for.
Is there any other way to obtain the desired goo.gl/ short url?

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).

Verify an Address with Google Maps Static API

I use google maps static api to show maps on my website and use the following url:
http://maps.googleapis.com/maps/api/staticmap?center=usa&size=800x300&maptype=roadmap&sensor=false&markers=color:blue|label:S|usa
However, if enter a non-existing address, google will return a picture like this:
http://maps.googleapis.com/maps/api/staticmap?center=notexistingaddress&size=800x300&maptype=roadmap&sensor=false&markers=color:blue|label:S|notexistingaddress
I would like to know, how can I determine, if an address exists or not, using google maps static api. I cannot use javascript, because this code is executed on server.
After reading the docs, I think that the Google Maps Static API has nothing (exept the way I suggest like verify the return of the picture manually or only the keyword notexistingaddress) to verify if an address exists or not.
The best way to do validation is I think the Google Geocoding API, where you can outpout a Json / XML of a given address. The status code of ZERO_RESULTS which indicates that the geocode was successful but returned no results may interest you.

How to Extract Transit Stop locations from Google Maps?

I'm building an application that requires the name, long, and lat for the transit stops in my area.
Google Maps API displays this information, but in this scenario I can't use the API and need to extract this information to an XML format.
I'm not sure if this is possible and can't find any reference to this on the web.
Any Ideas how I can extract the transit stop long, lat, and name from Google Maps, preferably to an XML format?
Now it's possible to get this done, check this post:
Detect the nearest transit stop from the given location
And if you want to see it in action try this jsfiddle:
http://jsfiddle.net/doktormolle/aZrvs/

Google Places API and Destination URL

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.