Checking whether an address exists. Google Maps SDK iOS - 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/

Related

What is the web Google URL to find the directions between 2 coordinates (lat, long)?

I am trying to open up google maps in the browser by passing it 4 points. What is the scheme to launch google maps so it inputs a start coordinate and an end coordinate?
It's not offically documented, but currently this works:
https://www.google.de/maps/dir/origin_lat,origin_lng/destination_lat,destination_lng/
e.g. Chicago to Detroit:
https://www.google.de/maps/dir/41.87,-87.62/42.33,-83.04/
You may also use addresses:
https://www.google.de/maps/dir/origin_address/destination_address/
https://www.google.de/maps/dir/Chicago/Detroit/
The URL parameters for this Google API are destination and origin, here you can use adresses or coordinates as values:
https://www.google.com/maps/embed/v1/directions?origin=sydney&destination=sydney&key=...
but be aware that for this service you need an API key. When using the javascript API you don't need an API key, at least if you don't have too much traffic.

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.

Google Geo coding service for getting only geocodes

We have a pharmacy search application. We are trying to get the the input address from
user and find pharmacies around that address in a user specified raduis.
We are planning to geo code the address entered by user from a third party service.
After getting the geocodes we will search for pharmacies in our DB around that address and
display the results. With each result there will be a link which will open a new tab/window of maps.google.com displaying the location.
If we use the google geocoding API service to get geocodes will they charge for it ? I am not showing the map on my UI. Is that ok or violating the google terms ? Is the 2500 requests/day applicable for this scenario as well ? I am seeing that MapQuest is a service which will return only geocodes.
Thanks,
Avinash.
Double check with Google's Terms of Service, but generally they begin denying your API requests after you reach your limit. If you are a repeat offender, they may permanently prevent your IP from using their API. The limit is on the calls that you make to the Geocoding API and is unrelated to whether you display a map using their maps api. The following includes strategies for how to work within these limits: https://developers.google.com/maps/articles/geocodestrat
MapQuest just released their Open Geocoding Web Service, which is built using data provided by the OpenStreetMap community, and (currently) does not have a limit on the number of geocoding requests that can be made.

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.

Google maps geocoding API inconsistent

I have a server application that calls the google maps geocoding API at http://maps.googleapis.com/maps/api/geocode/json
I experience that when the server application invokes such an URL, the response is sometimes ZERO_RESULTS.
If I take the exact same URL and paste in a browser, I get a valid result back.
Any ideas to what differences can cause this? HTTP headers? Something else?
In the link you provided it is missing the address, components, latlng or place_id parameters, besides the Google Map API KEY.
You need at least one of the parameters and the Key to get a proper response.
e.g.
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJ1xwGTLE1K4gRmzFDd_1HzPc&key=xxx
Just add your KEY and it should work.