Google Maps API: Can you explicitly qualify address parts - google-maps

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

Related

Google geo code API not filtering results for Luxembourg

I am filtering results for country code LU. Still getting results for US
https://maps.googleapis.com/maps/api/geocode/json?address=4321%2CLU&components=country%3ALU
Am I doing anything wrong here?
Documentation says that you cannot use country in both address and component filter. Doing that you can get unpredictable behavior.
https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering
Note: Each address component can only be specified either in the address parameter or as a component filter, but not both. Doing so may result in ZERO_RESULTS.
So, your query should be
https://maps.googleapis.com/maps/api/geocode/json?address=4321&components=country%3ALU&key=YOUR_API_KEY
Not sure what means 4321. If this is a postal code, I think it is missing from Google database, because
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code%3A4321%7Ccountry%3ALU&key=YOUR_API_KEY
returns ZERO_RESULTS.
No, you didn't make any big error; your API call should work ok. I believe this was a bug in Google's API, but it seems to be fixed now. (When I go to the url you asked about, I get a proper JSON response that doesn't mention the US.) (If you reported the error, maybe you deserve the credit for getting it fixed! :)
The reason there were issues initially is because Google isn't an address verification or standardization service. Parsing is difficult for many reasons: there could be weird spellings or punctuation, for instance. Google is very good at parsing search terms.
But, there is an additional problem: how do we know which parts match the city or the state? "Georgia" is a state in the US and a country. Should "12 34 St Helena WA 85102" match "34 street" or a road named "St Helena"?
Address verification means to check an address against an authoritative database, such as postal office data and national records, resulting in a match to a real place. Address standardization means to format an address in the way the postal service standardizes it.
Thus, you will most likely run in to more issues like this in the future, especially if you're using addresses that are ambiguous. You may want to try address validation services, especially if you are working with mailing and shipping.
Fair disclosure: I'm an employee of SmartyStreets, an address validation company.

Google Geocode API Address Formatting United States

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

How can I create links Google Maps that either use the place name in the query (for known places) or just the address otherwise?

I am creating links to Google Maps for a large number of locations using this URL pattern:
https://www.google.com/maps?q=[query]
In many cases, Google knows that the particular business exists at that location. In those cases, I want to include the place/business name in the query so the resulting map shows additional information about the business (e.g. name, phone numbers, site URL, office hours, etc.). For example:
https://maps.google.com/?q=Child+Guidance+Center,+Inc.+525+Cabrillo+Park+Dr+#300+Santa+Ana,+CA+92701
But, if the place isn't known, including the business name in the query prevents the map from adding a marker to the correct address. For example:
https://maps.google.com/?q=Awesome+Paint+527+Cabrillo+Park+Dr+Santa+Ana,+CA+92701
It can cause the map to be totally zoomed out, or focus on a competing business with a somewhat similar name in the same general area.
How can I make this work better? I would like the map pin to always go in the correct location for the address I specify. If the business name I provide is known to Google at that address, then I'd like the nice panel of extra information. If it is not known, I just want the pin.
Thank you.
This similar question is asking about creating embedded maps, which is a slightly different case Google map to show name of location if found, otherwise just the address. I'd prefer to avoid extensive use of the APIs because I'm worried about exceeding the free limit, but more generally geocoding the address that worked above (Child+Guidance+Center,+Inc.+525+Cabrillo+Park+Dr+#300+Santa+Ana,+CA+92701) returns zero results like so:
http://maps.googleapis.com/maps/api/geocode/json?address=Child+Guidance+Center,+Inc.+525+Cabrillo+Park+Dr+#300+Santa+Ana,+CA+92701

Getting correct address from user typed street address using google maps

I've never used the google-maps api, but I just want to do one particular thing.
I've got around 1000 user typed street addresses. Some are missing states and postcodes. I've noticed if I type these addresses into google maps it generally gives me back the state and postcode (only very rarely it gives some options). Is there a way to do this programatically, so I don't have to manually copy/paste this in? Has someone already made an application/library to do this that I can just feed the user typed data to?
Edit:
I've noticed this does the job:
https://maps.google.com.au/maps?q=1%20George%20st%20sydney
It returns state and postcode. But it returns it on a webpage with a whole lot of other stuff. I just want the address only. I guess I could grep through the results, but some additional thing to add to the query string so it only returns the raw address (or some structure) would be useful.
You can use the Geocoding API - https://developers.google.com/maps/documentation/geocoding/
E.g. http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=1%20George%20st%20sydney ; you can replace "json" with "xml" if you prefer. Look for "formatted_address" in the result, or individual address components, depending on what you need.
However, I'm quite frustrated that it sometimes doesn't work, even for some cases where the regular google maps search is successful.

Google maps API - geocoder doesn't find 'Carson, CA'

I have a customer with store locator functionality based on Google maps API. Couple days ago the complained about locator not able to find 'Carson, CA'
Here's a really simple demo from Google itself and it doesn't work either:
http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html
Is there a way to contact Google support? I tried to search for any contact information but couldn't find anything useful.
It does look like a bug as there is a Carson marked on the map south of Los Angeles. It happens: geocoder data gets updated and sometimes things get missed off. Bugs need to be raised in the issue tracker. Be sure to search first (although I didn't find a previous report for this) and choose the right template when raising a new bug.
http://code.google.com/p/gmaps-api-issues/issues/list
For a store locator app, you may find searching for West Carson provides a decent start point, although this is hardly a usable workaround. Try using the zip code instead.
I don't think this is actually a bug; let me gently suggest that I think you are probably using the wrong API for looking up "Carson, CA." I'm not being harsh, just trying to help. But Geocoding has two basic functions:
Given an address as input, reply with the best Lat-Lng coordinates for that address.
Given coordinates as input, reply with the closest known address (sometimes called Reverse Geocoding).
With "Carson, CA" as input, it doesn't seem like you have given enough information to have defined an address, which probably means that the Geocoder just didn't have enough information. The same goes for the Store Locator; "Carson, CA" isn't a store.
I think what you do want to use for a search of this kind is the Google Places APIdev-guide, because you are actually looking for a place, not coordinates or an address. Using the Google Places Autocomplete, for example, you can set the tool to search for different types, for example: countries, cities, or geocode (and there are others). The first, countries will let you find places such as: Australia, Bahamas, or Canada. The second, cities, will let you find places such as: Albuquerque, Baton Rouge, or Carson, CA. The last, geocode will restrict you to address searches, which is essentially what you are using when using the Geocoder.
I made the same mistake myself the other day when I sent a request to the Geocoder that contained "Wrigley Field"; the result was some address in Georgia on "Wrigley Field Road," which had me very confused until I thought about it for awhile and then it made sense. Wrigley Field is a place, not an address. I have been working with the Autocomplete a bunch lately and that has really made the difference between the two modes of lookup clear. As a possible solution for you, if you don't provide a specific type to the Autocomplete, it will use all of them, which will allow you to find places and/or addresses. It might give you a more functional solution for your site.
Anyway, just trying to offer some helpful feedback and I hope I did help -