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

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 -

Related

Google Places API Text Search doesn't filter address correctly

I am using Google Places API Text Search to fetch for pharmacies and looks like it isn't filtering address correctly.
When I search for Walgreens, it returns some results from Broadlands, Herndon and some other locations.
If I search for Walgreens Broadlands or Walgreens Herndon, it returns nothing.
But if I search for Walgreens Miami or Walgreens Village it returns correctly.
Other strange behaviour is that, sometimes, executing the same request two times returns different results. For that reason, I don't know if you will get the same results using the links I provided.
Google documentations states the following:
The service is especially useful for making ambiguous address queries in an automated system, and non-address components of the string may match businesses as well as addresses. Examples of ambiguous address queries are incomplete addresses, poorly formatted addresses, or a request that includes non-address components such as business names.
From my understanding, the examples I gave should work just fine.
Am I missing something? What is wrong in these cases?
It sounds like a bug, I would suggest filing an issue in Google Issue tracker for Places API.
The unique workaround I can think about is providing an additional information about the area where you are searching the Walgreens pharmacy. I believe the queries with location bias work better than without it. If I use the coordinate of Broadlands (39.0181644,-77.5202688) and specify radius of 50 km, the Places API text search for Walgreens return results
https://maps.googleapis.com/maps/api/place/textsearch/json?query=walgreens&location=39.0181644%2C-77.5202688&radius=50000&type=pharmacy&region=US&key=MY_API_KEY
as shown in the screenshot
I hope this helps!

Google geocoding API returns ZERO_RESULTS for postal code

I am trying to geocode user entered data using the Google maps API, and got an error for the Australian postal code "2010"
maps.google.com/maps/api/geocode/json?components=country:AU|postal_code:2010
However, if I search in Google maps, I get a result. Am I doing something wrong in my request?
Your request is completely OK, but unfortunately, Google experience issues with searching 4-digit postal codes. This bug has already been reported in Google issue tracker and you can see it here:
4-digit postal codes are hard to geocode (AT, AU, BE, DK, NZ, SI)
I would suggest starring the bug to add your vote and subscribe to further notifications from Google.
Also you can see that suggested workaround by Google is using place autocomplete request with types (region) and country components filter.
So, in your case you can run the following query
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=2010&types=(regions)&components=country%3AAU&key=YOUR_API_KEY
It will return a place ID for postal code 2010: ChIJ3QyubXuuEmsREIe6P2t9ARw
And you can use geocoding with place ID to get required information
https://maps.googleapis.com/maps/api/geocode/json?place_id=ChIJ3QyubXuuEmsREIe6P2t9ARw&key=YOUR_API_KEY
I hope this helps!
I experienced a similar issue periodically, when geocoding US zip-codes. Appending the country name after the zip-code seemed to fix the problem. So, instead of 60162 use 60162 USA.
When a URL is opened in the browser based on its IP context, it identifies the country and automatically deduces the query format for a zip code is 99.999-99.
The format above is for Brazil, but there are different standards for each country such as USA and Portugal.
One solution when calling an API via CURL, either by code or by terminal, include the "&components = country: US" parameter, changing the "US" country code to what you want to filter.
The Google API returns ZERO_RESULTS for safety, because a search would be too slow and could do a global search worldwide and not just the country. For performance and speed reasons, Google creates this automatic ID for help, but unfortunately is not provided to developers about this process.
Good luck!

google places and geocode not returning full results list

I am doing some mapping work and need to find latitude and longitude of villages in india many of which are small and rural. I am having trouble finding the full set of locations with the same name, for example a village named 'Kallanai' (see api links below, note they need appropriate keys for the places API to run on your computer). I can find the one I'm looking for in google maps by entering www.google.co.in/maps/place/Kallanai into the browser however it will not turn up in the geocoder or places api without specifying the associated pin code (analogous to zip-code). Can anyone explain why the basic searches for either the geocode or places API using the village name alone do not return the village with the pincode 625501 in the results?
e.g.
Google places:
https://maps.googleapis.com/maps/api/place/textsearch/json?query=kallanai&sensor=false&key=enter your key
https://maps.googleapis.com/maps/api/place/textsearch/json?query=kallanai+625501&sensor=false&key=enter your key
will post google geocode links in follow up as stackoverflow will not let me include more than 2 links in my post without more points.
In a world where autocomplete is common and almost taken for granted, Google Maps has (long) switched to showing just the one results your most likely looking for.
Places Autocomplete API might get you more of what you're looking for, but it would still be a sub-optimal fit for database-like queries like this. It works best when you have users typing, each of them knowing which Kallanai they want, so they can select the suggestion that matches, and they can add details (e.g. PIN code) to get it if the suggestion doesn't show up at first (max 5 suggestion show each time).
Google does Geocoding in a different way from classic GIS databases. To obtain all cities [with a given name] in a given country, you'd probably need a database like GeoNames or Natural Earth.

Locating current Google Place i'm at by latitude/longitude via Google Places API

i have a lat/long location data and i need to get current Google Place where i'm at now.
For example, if i'm in a shop(cafe, gym, etc..), i need to get info about THAT particular shop(cafe, gym, etc..).Or at least the closest one.
So, i'm doing it this way:
First i fetch place basic info(placeid,name, etc.) via Google Places API Nearby Search request:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.7597351,-73.9836576&radius=16.66&key=...
Then i find the closest one(which is apparently where i am) and perform Place Details request with it's placeid
So, everything works fine, except for some places like the one located at 40.7597351,-73.983657 (New York Guitar lab shop) which i can see on google map, but can't get in my response. Even places that are further from my location than this, are being found fine.
I've already tried to use rankBy=distance and then checking if the result is in required radius manually, still no use. Actually, maybe this approach is right, but as told in the docs, it's required to use types parameter with rankBy=distance. So, i set types=establishment since i actually need everything except addresses and locality tokens returned. I think that the problem is some places i need, are neither counted as establishments nor as localities, but i don't know the optimal way to exclude
all types specified at (https://developers.google.com/places/documentation/supported_types) Table 2 from my response. Is there a way to get only places which types are in Table 1 (except for specifying them ALL in my types param, haha)
So, could you please help me with how can i do this?
Thanks:)
P.S. here is very similar but unaswered question
Google Places API Displaying Inaccurate Result
It seems that there's explanation here (https://developers.google.com/places/faq#why_are_some_places_never_returned_even_though_they_have_google_pages). Looks like some places are just not yet verified by Google.
And yes, the establishment is the generic category for all non-localities. So you can be sure that if you set type=establishment then you'll have as much places as you will, if you'll specify all types from Table 2. Good Luck!

Mapping a set of ZIP codes

I'm working on a delivery service that only delivers within certain ZIP codes (probably, but not necessarily, all contiguous). Given a list of ZIPs, how do I get a map on which those ZIPs' areas are highlighted or outlined?
http://www.udsmapper.org/
This should be exactly what you need.. for personal/non-commercial use only though...
If you have a list of zip codes you can even paste them into the system and they'll automatically map!
Here is their user guide too:
http://www.udsmapper.org/docs/NEW_Instructions_Creating_Service_Area_Map_10102014.pdf
Here are some links of some helpful sites:
http://benfry.com/zipdecode/
http://maps.huge.info/
http://maps.huge.info/blog/boundary_maps/
http://www.usnaviguide.com/zip.htm
I didn't spend very much time searching these sites, but it didn't look like they were sharing their databases. That's what you are going to need... A database that can give you the lat/long coordinate boundary of the zip code area. I don't believe neither Google nor Bing offer a service that does that conversion for you.
Once you are able to do that conversion, from zip code to lat/long boundary, it should be pretty straight forward in both the Bing maps control and the Google api. If you have more specific questions on the actual implementation, then just leave me a comment.