Google Geocode API Address Formatting United States - google-maps

This question is similar in spirit to. http: //stackoverflow.com/questions/7764244/correct-address-format-to-get-the-most-accurate-results-from-google-geocoding-ap
I've read the FAQ on the google geocode developers guidelines and it states that the suggested format for addresses is based off the country's postal service. In some of my testing this is not always working and sometimes I'm seeing better results putting the street at the end of query.
example being: http://maps.google.com/maps/api/geocode/xml?address=+3700%20W%20FLAMINGO%20RD++LAS%20VEGAS+NV
This returns zero results, but swapping road to the end returns a correct result:
http://maps.google.com/maps/api/geocode/xml?address=++LAS%20VEGAS+NV+3700%20W%20FLAMINGO%20RD
On top of that if I include the zipcode (89103) to the second request, that one will return no results as well.
Can anyone help me to understand what the appropriate format should look like for US addresses?
Thanks much!
-Chris

The answer you can find in this document
https://developers.google.com/maps/faq#geocoder_queryformat
How should I format my geocoder queries to maximise the number of successful requests?
Specify addresses in accordance with the format used by the national postal service of the country concerned.
Do not specify additional address elements such as business names, unit numbers, floor numbers, or suite numbers that are not included in the address as defined by the postal service of the country concerned.
Use the street number of a premise in preference to the building name where possible.
Use street number addressing in preference to specifying cross streets where possible.
Do not provide 'hints' such as nearby landmarks

Related

What is the recommended format for search query in Google and Apple maps?

I want to show the direction from my React Native app to the specific address in Google or Apple maps application depending on the Platform. Are there any requirements for address query format so I can get better search results?
I've found following for Google https://developers.google.com/maps/faq#geocoder_queryformat. Any ideas for Apple Maps?
Here what I’ve found in official docs
Google
How should I format my geocoder queries to maximise the number of successful requests?
The geocoder is designed to map street addresses to geographical coordinates. We therefore recommend that you format geocoder requests in accordance with the following guidelines to maximize the likelihood of a successful query:
Specify addresses in accordance with the format used by the national postal service of the country concerned.
Do not specify additional address elements such as business names, unit numbers, floor numbers, or suite numbers that are not included in the address as defined by the postal service of the country concerned. Doing so may result in responses with ZERO_RESULTS.
Use the street number of a premise in preference to the building name where possible.
Use street number addressing in preference to specifying cross streets where possible.
Do not provide ‘hints’ such as nearby landmarks.
https://developers.google.com/maps/faq#geocoder_queryformat
Apple
Use the CLGeocoder class with a dictionary of Address Book information or a simple string to initiate forward-geocoding requests. There is no designated format for string-based requests: Delimiter characters are welcome, but not required, and the geocoder server treats the string as case-insensitive. For example, any of the following strings would yield results:
“Apple Inc”
“1 Infinite Loop”
“1 Infinite Loop, Cupertino, CA USA”
The more information you can provide to the forward geocoder, the better the results returned to you. The geocoder object parses the information you give it and if it finds a match, returns some number of placemark objects. The number of returned placemark objects depends greatly on the specificity of the information you provide. For this reason, providing street, city, province, and country information is much more likely to return a single address than providing only street and city information. The completion handler block you pass to the geocoder should be prepared to handle multiple placemarks, as shown below.
[geocoder geocodeAddressString:#"1 Infinite Loop"
completionHandler:^(NSArray* placemarks, NSError* error){
for (CLPlacemark* aPlacemark in placemarks)
{
// Process the placemark.
}
}];
https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders.html

Find city in Google Geocoding API

I am using google Geocoding API to store the cities in the DB on demand.I provided an input field for the user to enter their city.I used googles places autocomplete for that.
I would like to store the city and its country what ever enter ed in the input field. Calling google geocoding API with the with data from input field, returned data in JSON.
I looked into address_components got country in it. Then I took object in address_components where types = locality. The problem is,For some locations typed in the input field, The JSON from google geocoding API doesn't have types = locality. So in these cases, which one among the objects in address_components should I store as city in my DB.
this website is exampale of google geocoding api https://findcity.in/
Need suggestions. The question may not be clear earlier. So I edited it. Thanks
You are right, the type locality is not always present in the address components array. Depending on the country or even regions of the same country the city name might be found in different address components. This depends on the data modelling for certain area and address templates that uses Google. Unfortunately, there is no documentation for this on per country basis.
In the official documentation you can find the following explanation
The selection of specific address components in this example is based on a typical address format. You may need to select different components to align with the postal address formats of different countries. For example, the code selects the locality component, which often represents the city part of the address. However, note the following examples of how the components may differ:
In the UK and Sweden the correct component to display the city is postal_town.
In Japan, the component differs across prefectures.
Brooklyn and other parts of New York City do not include the city as part of the address. They use sublocality_level_1 instead.
source: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform
I hope this helps a bit.
administrative_area_3 indicates a third-order civil entity below the country level.
An example of this would be a search query for Montgomery returning Montgomery County in your specific state before Montgomery, AL. This is partially due to region biasing returning specified results based on your current location.
Here is some documentation from Google Which goes over the GeocoderResult.
I'd like to encourage you to make sure to take a look at the Google Maps APIs reference guide before asking a question directly. It is rather robust and you can find a lot of useful information there.

Google Maps Geocode - Wildcard searches beyond exact matches

Anyone know if the Google Maps Geocoding service can return results including locations that start with the search term when it finds an exact match for the search term?
Here's my example
In Australia if I search for the term "Bass", I get exactly one result because there is one town in Australia called Bass. But I also want to include any other town that may start with Bass - EG "Bass Hill" and "Bassendean".
I haven't found a reference or example - any help would be appreciated!
I doesn't see any way to do this.
Found this from google geocoding reference.
How should I format my geocoder queries to maximise the number of successful requests?
The geocoder is designed to map street addresses to geographical coordinates. We therefore recommend that you format geocoder requests in accordance with the following guidelines to maximise the likelihood of a successful query:
* Specify addresses in accordance with the format used by the national postal service of the country concerned.
* Do not specify additional address elements such as business names, unit numbers, floor numbers, or suite numbers that are not included in the address as defined by the postal service of the country concerned.
* Use the street number of a premise in preference to the building name where possible.
* Use street number addressing in preference to specifying cross streets where possible.
* Do not provide 'hints' such as nearby landmarks.
Now, given above it(google geocoding webservice) isn't going to assume the inputs given by you for some other input. It tries to map the inputs given by you to the street address, city, country or something else like that.

Google Maps API: Can you explicitly qualify address parts

We're using the Google Maps API for an application to determine distance and driving directions for a set of addresses in a database. Overall, we're dealing with around a 1000 addresses and some have typos, abbreviations,... that are causing some problems with returning the proper address hit (lat/long).
For addresses that don't return a proper result, we are trying to drop parts of the address (i.e. just use Address and Zip, and not City, State). But we're finding that some of the results are waaaaay off (i.e. somewhere in Poland).
So, we're wondering if it's possible to qualify the address parts (i.e. address=1600 Pennsylvania Avenue&zipcode=49455) to avoid misinterpretation by Google maps. Anyone know if it's possible to do this?
I think you're stuck with just sending the string to google and dealing with what you get back. One thing you can do is use GClientGeocoder.setViewport() to specify a bounding box where your results should show up and/or use GClientGeocoder.setBaseCountryCode() to specify that your results should be in a specific country.
http://en.wikipedia.org/wiki/Garbage_In,_Garbage_Out "GIGO" is the rule when it comes to addresses.
Rather than trying to clean the list yourself, there are plenty of mailing list companies that will cleanup your address list for a fee.
They will correct addresses, and identify bogus addresses. They will also run your list through the post office's Forwarding database. That will give you the current addresses for your older data.
People and businesses move constantly.
Added--
If you have good zip codes, you can use them instead of the city, state. Just use "10 main st, 10045" as your input to Google. But you need to know that your zip codes are correct. (A mailing list company will handle that for you.)

How to geocode non-standard business addresses

I have small database of business and their addresses. Using the Google Geocode API, I've been abel to get maybe 80% accuracy. If a business has a simple address on a street, Google usually does a good job. However, many business have odd addresses, which are presented differently depending on the database. Example:
Royal Copenhagen
Manly 1
Shop 2A, The Corso (Wharf End)
Manly NSW 2095
(02) 9977 1618‎
Google's Geocoder fails to find a good address for this location. However, if I Google for 'Royal Copenhagen, Manly NSW 2095', I can easily find the address, and the pin has the correct location:
2 The Corso
Manly New South Wales 2095, Australia
(02) 9977 1618‎
Right now, I have my geocoding program trying various combinations of the address fields in attempt to get the best location. Note, on Google Maps, entering the phone number and city returns very good results, but the geocoder returns much different results.
Has anyone had any success programatically geocoding databases like this?
Personally I use YAHOO's geocoder for getting the long/lat information and I use Google's API to map the data. I ran into the same issue where Google just wasn't quite up to the job of more complicated addresses but the Yahoo API has more flexibility. I'm also running a very small application and its not an issue using both but your mileage may vary.
It's possible that the Google API is not sufficiently sophisticated for this purpose.
I once used a commercial product for geocoding. The product included a stack of DVDs, updated monthly, for geocode data for as much of the world as you might wish to pay for. This was not a trivial system to use, but it got its parsing and geocoding data from the Postal Authorities of countries around the world, so could stay up to date. The theory was that any address which would permit a letter to be delivered could be parsed and geocoded.
I do not recommend this product. I will tell you the name only so that you can search and find their competitors. The product was Trillium.
I found I could use the Google AJAX Search API for my purposes. It's design to be used from within JavaScript, but it's possible to call directly from Python. For a search, it will return a list of matching business, and their geocoded locations.
google only can geocode those address which is in there database , it is not dynamic
if you want to do this i think that yopu have to write an application to find the latitude and longitude and save to your database then it will be easy.......... :)