1
votes

Query with 'st' returns zero results: http://maps.googleapis.com/maps/api/geocode/json?client=client_id&sensor=false&address=100+main+st%2CAtlanta%2CGA%2CUSA&language=en&signature=sing

{
"results" : [],
"status" : "ZERO_RESULTS"
}

This query returns address: http://maps.googleapis.com/maps/api/geocode/json?client=client_id&sensor=false&address=100+main%2CAtlanta%2CGA%2CUSA&language=en&signature=sign

{
"results" : [ *********** ],
"status" : "OK"
}

What is the reason of such behavior? The search string '100 Main St, Atlanta, GA' is working well at maps.google.com

1
Not certain, but what did you expect for e.g. "Mount St Helens" ? Abbreviations are not unique.MSalters
St stands of street in my case. The search string '100 Main St, Atlanta, GA' is working well at maps.google.com, but geocoding api does not return any results.user2641379

1 Answers

1
votes

You have two issues at the same time here.

1st. you're asking about an address that does not exist; this will dramatically affect the ability of the api to match a result for you.

2nd. as alluded to in the comments, "st" has some ambiguity etc.

Ultimately, your query is going to have some "correlation score" with each entry in the results, and only results above some internal threshold will be given to you.

This matching threshold is affected by both above issues.

100 Main St, Atlanta, GA isn't real, and does not resolve to a location. As far as I can tell, it does not even work at maps.google.com

when matching locations (real or not), the text you enter will matter. e.g. your second example which you x'd out the results actually is in Forest Hills, GA. And that's b/c for whatever reason the lack of "st" allowed it to match well enough for google to suggest it as possible. With "st" however, or "street", the resolution threshold isn't as good, and you're getting 'zero results'.

use a real address, like say: 546 main st, and you'll notice that the '', 'st', 'street' still matters (it still affects matching thresholds), but less so.

here are some examples:

curl -s 'http://maps.googleapis.com/maps/api/geocode/json?address=546+main,+Atlanta,+GA&sensor=false' | grep formatted | grep 546
         "formatted_address" : "546 Main Street Northeast, Atlanta, GA 30324, USA",
curl -s 'http://maps.googleapis.com/maps/api/geocode/json?address=546+main+st,+Atlanta,+GA&sensor=false' | grep formatted | grep 546
         "formatted_address" : "546 Main Street Northeast, Atlanta, GA 30324, USA",
curl -s 'http://maps.googleapis.com/maps/api/geocode/json?address=546+main+street,+Atlanta,+GA&sensor=false' | grep formatted | grep 546
         "formatted_address" : "546 Main Street Northeast, Atlanta, GA 30324, USA",

now, the order and multiplicity of results does vary, which you can easily observe if you drop the "| grep" stuff, but you can see clearly, that in all cases for this particular address you would get a viable result. This may not be true for "every" real address, but i think you could reasonably expect to get back a viable result if you're after a real address with text that isn't overly ambiguous, as is somewhat spoken to by above comments.