0
votes

This results in a JSON string that contains street_number - http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

"long_name" : "1600",
"short_name" : "1600",
"types" : [ "street_number" ]

However, this does not result in a JSON string that contains street_number - http://maps.googleapis.com/maps/api/geocode/json?address=26th+St+2nd+Ave+New+York,+NY+10019&sensor=false. The 26th St part just seems to disappear. Any idea why?

3

3 Answers

0
votes

Obviously because 26th St part isn't street_number. 26th St and 2nd Ave are both street names so it just discards 26th St part of the query. While in the first query 1600 is really a street_number.

1
votes

Geocoding in general is non-deterministic. Although it is not common, the same query may return results of different accuraccy depending on changes in the internal implementation of the geocoding process.

Another issue is that some place may not have a street address or the algorithm was not capable of approximating one.

You should be aware of these factors and handle all of these different cases. I suppose there is nothing you can do from your side to ensure consistent replies from the google server.

0
votes

Another scenario where street number is sometimes discarded is when it has a directional prefix, like 315 West 44th Street. In this case, results can be more accurate if the prefix is abbreviated, like 315 W 44th Street. While I have not seen this documented, every google map I've seen abbreviates directions this way, so perhaps addresses are stored that way internally and the chance of a good result is improved by abbreviating before geocoding.