Some Places Detail provided by Google Places are not correct.
For example if you type Serengeti National Park in the Autocomplete, you have :
{ "predictions" : [
{
"description" : "Serengeti National Park, Serengeti, Mara, Tanzania",
"id" : "08bd9d4d10a2c77c36987c118a638ba8f75fb2f1",
"matched_substrings" : [
{
"length" : 23,
"offset" : 0
}
],
"reference" : "CkRAAAAAWmw4d0BvC9XVNF73sDnNPiQ841LRJ02RiaLxFonlOJmvmbP01nFpaJVfQVTa1lJScXHCOGtu9P83kUOYAd7f2xIQ_KqR0A_Sbhg8qvEEaIwlEBoU1dU8yFyfIhcZFfRNpdNGpacv6V8",
"terms" : [
{
"offset" : 0,
"value" : "Serengeti National Park"
},
{
"offset" : 25,
"value" : "Serengeti"
},
{
"offset" : 36,
"value" : "Mara"
},
{
"offset" : 42,
"value" : "Tanzania"
}
],
"types" : [ "establishment", "geocode" ]
} ], "status" : "OK" }
Which is ok. Note the description: Serengeti National Park, Serengeti, Mara, Tanzania.
However if you access the Google Places Details you have this:
{
"debug_info" : [],
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Serengeti",
"short_name" : "Serengeti",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Mara",
"short_name" : "Mara",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "TZ",
"short_name" : "TZ",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Tanzania",
"geometry" : {
"location" : {
"lat" : -2.333333,
"lng" : 34.833333
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "08bd9d4d10a2c77c36987c118a638ba8f75fb2f1",
"name" : "Serengeti National Park",
...
},
"status" : "OK"
}
We can see that the formatted address isn't correct, the country name is TZ instead of Tanzania, etc.
I want to pass this data to the Geocoding so I can have a viewport and other geometry data, but for that I need a proper address, like the one given in the predictions.description.
Is there a way to get this data upon selction of this place in the autocomplete?
Or is there another way to get information needed to geocode this place?
Thanks a lot
Related
I've seen this problem mentioned in other threads but they are often using older versions of google maps and are no longer valid.
If I use the request parameters and access the following url (https://maps.googleapis.com/maps/api/geocode/json?region=ca&address=10+York+Street%2C+Sydney%2C+NS%2C+Canada&key=API_KEY) directly in my browser I get the following response:
{
"results" : [
{
"address_components" : [
{
"long_name" : "10",
"short_name" : "10",
"types" : [ "street_number" ]
},
{
"long_name" : "York Street",
"short_name" : "York St",
"types" : [ "route" ]
},
{
"long_name" : "Sydney",
"short_name" : "Sydney",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Cape Breton Regional Municipality",
"short_name" : "Cape Breton Regional Municipality",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Nova Scotia",
"short_name" : "NS",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Canada",
"short_name" : "CA",
"types" : [ "country", "political" ]
},
{
"long_name" : "B1P 6B1",
"short_name" : "B1P 6B1",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "10 York St, Sydney, NS B1P 6B1, Canada",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 46.1427341,
"lng" : -60.19779020000001
},
"southwest" : {
"lat" : 46.1425438,
"lng" : -60.1980493
}
},
"location" : {
"lat" : 46.1426556,
"lng" : -60.19790510000001
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 46.14398793029149,
"lng" : -60.19657076970849
},
"southwest" : {
"lat" : 46.1412899697085,
"lng" : -60.1992687302915
}
}
},
"place_id" : "ChIJl_ddHCz7Z0sRQmXbPQOCT90",
"plus_code" : {
"compound_code" : "4RV2+3R Sydney, NS, Canada",
"global_code" : "87RX4RV2+3R"
},
"types" : [ "premise" ]
}
],
"status" : "OK"
}
Which is what I'm looking for. Great.
However if I make that same request in my program I get the wrong place, namely the same street address but in Ontario:
{
"results" : [
{
"address_components" : [
{
"long_name" : "10",
"short_name" : "10",
"types" : [ "street_number" ]
},
{
"long_name" : "York Street",
"short_name" : "York St",
"types" : [ "route" ]
},
{
"long_name" : "Old Toronto",
"short_name" : "Old Toronto",
"types" : [ "political", "sublocality", "sublocality_level_1" ]
},
{
"long_name" : "Toronto",
"short_name" : "Toronto",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Toronto",
"short_name" : "Toronto",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Ontario",
"short_name" : "ON",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Canada",
"short_name" : "CA",
"types" : [ "country", "political" ]
},
{
"long_name" : "M5J 0E1",
"short_name" : "M5J 0E1",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "10 York St, Toronto, ON M5J 0E1, Canada",
"geometry" : {
"location" : {
"lat" : 43.64109759999999,
"lng" : -79.38122469999999
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 43.64244658029149,
"lng" : -79.37987571970848
},
"southwest" : {
"lat" : 43.6397486197085,
"lng" : -79.3825736802915
}
}
},
"place_id" : "ChIJBQZc3pM1K4gRIf5tNOFZWxI",
"plus_code" : {
"compound_code" : "JJR9+CG Toronto, ON, Canada",
"global_code" : "87M2JJR9+CG"
},
"types" : [ "establishment", "point_of_interest" ]
}
],
"status" : "OK"
}
If I change the address to 12 York Street in my app everything is working great and it shows me the NS address. I guess Google has it out for this one particular address. I make the request in my app with the following code:
$response = $this->client->request('GET', 'geocode/json?', [
'query' => [
'key' => Config::get('services.googleMaps')['key'],
'region' => $this->ccTLD,
'address' => urlencode($this->searchstr),
]
]);
$jsonString = $response->getBody()->getContents();
Log::info($jsonString); // Shows response quoted up above
Where region is 'ca', and address is '10+York+Street%2C+Sydney%2C+NS%2C+Canada'. The client here is a standard GuzzleHttp Client:
$this->client = new Client([
'base_uri' => 'https://maps.googleapis.com/maps/api/'
]);
I've tried using adding the bounds parameter with no difference at all, but the components parameter did ...do something for me. If I add '&components=administrative_area:NS' to the request in my browser (which starts off showing me NS) there is no change as expected.
If I then go back to my http client and add 'components' => 'administrative_area:NS', I would expect that to be the fix, right? Well no, I get ZERO RESULTS.
Out of curiosity I went back to the browser and tried to use administrative_area:ON to force it to show me the Ontario address. I instead was shown ZERO RESULTS in the browser now instead.
Does anyone know how to make my request in the client work correctly? or know why it is behaving completely differently in the first place? Is there a problem with GuzzleHttp I don't know about that could be responsible? I'm completely baffled here.
Why do I get reponse with a different place_id, then the one I used in my place details API query?
https://maps.googleapis.com/maps/api/place/details/json?placeid=Eiw5LzUwIE1hcmtldCBTdHJlZXQsIE1lbGJvdXJuZSBWSUMsIEF1c3RyYWxpYSIwEi4KFAoSCR3TztZMXdZqEREXsZzx5CRAEDIqFAoSCXUvVtBMXdZqEc9Cc6QFzzMr&fields=address_components,formatted_address,place_id,types&key=
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "50",
"short_name" : "50",
"types" : [ "street_number" ]
},
{
"long_name" : "Market Street",
"short_name" : "Market St",
"types" : [ "route" ]
},
{
"long_name" : "Melbourne",
"short_name" : "Melbourne",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Melbourne City",
"short_name" : "Melbourne",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Victoria",
"short_name" : "VIC",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Australia",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "3000",
"short_name" : "3000",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "50 Market St, Melbourne VIC 3000, Australia",
"place_id" : "Eis1MCBNYXJrZXQgU3QsIE1lbGJvdXJuZSBWSUMgMzAwMCwgQXVzdHJhbGlhIjASLgoUChIJHdPO1kxd1moRERexnPHkJEAQMioUChIJdS9W0Exd1moRz0JzpAXPMys",
"types" : [ "street_address" ]
},
"status" : "OK"
}
Also I noticed the address returned is different.
The placeid in my query, is what I received for an autocompletion service response.
{
"description" : "9/50 Market Street, Melbourne VIC, Australia",
"id" : "06f000a321dc5f1347b79dcbe4d611390f750f36",
"matched_substrings" : [
{
"length" : 18,
"offset" : 0
}
],
"place_id" : "Eiw5LzUwIE1hcmtldCBTdHJlZXQsIE1lbGJvdXJuZSBWSUMsIEF1c3RyYWxpYSIwEi4KFAoSCR3TztZMXdZqEREXsZzx5CRAEDIqFAoSCXUvVtBMXdZqEc9Cc6QFzzMr",
"reference" : "Eiw5LzUwIE1hcmtldCBTdHJlZXQsIE1lbGJvdXJuZSBWSUMsIEF1c3RyYWxpYSIwEi4KFAoSCR3TztZMXdZqEREXsZzx5CRAEDIqFAoSCXUvVtBMXdZqEc9Cc6QFzzMr",
"structured_formatting" : {
"main_text" : "9/50 Market Street",
"main_text_matched_substrings" : [
{
"length" : 18,
"offset" : 0
}
],
"secondary_text" : "Melbourne VIC, Australia"
},
"terms" : [
{
"offset" : 0,
"value" : "9/50 Market Street"
},
{
"offset" : 20,
"value" : "Melbourne"
},
{
"offset" : 30,
"value" : "VIC"
},
{
"offset" : 35,
"value" : "Australia"
}
],
"types" : [ "route", "geocode" ]
}
Looks like for some reason, google maps is dropping the subpermise information, when using the place details API and returning the street_address.
Is there a way I can force google maps API to return me the details for the subpremise?
The long place ID like Eis1MCBNYXJrZXQgU3QsIE1lbGJvdXJuZSBWSUMgMzAwMCwgQXVzdHJhbGlhIjASLgoUChIJHdPO1kxd1moRERexnPHkJEAQMioUChIJdS9W0Exd1moRz0JzpAXPMys in your example means that there is no exact street address for your search in database of Google. This is an approximation. When you search an address that exists in the database you will get shorter place ID (e.g. ChIJrTLr-GyuEmsRBfy61i59si0).
If address doesn't exists in Google database you can get one long place ID from autocomplete service and a different long place ID from the place details endpoint. These endpoints can use different algorithms for approximations that results in different place IDs for addresses that are not found in the database.
Both types of place IDs are mentioned in the documentation
https://developers.google.com/places/place-id#id-overview
The most straightforward way to fix the issue is reporting a missing address to Google data team as described in
https://support.google.com/maps/answer/6320846.
Once added in Google database your issue will disappear, you will get a short place ID both in autocomplete and in details.
Also your issue might be related to the bug reported in Google issue tracker regarding limited support of subpremises in place autocomplete service. Have a look at
https://issuetracker.google.com/issues/35830389
I hope this addresses your doubt.
If I have a PlaceId that represents a road, how can I obtain the shape of the road to highlight it on the map? The Places API only returns a single location in the geometry field for roads.
For example given PlaceID: ChIJ8R8rpjCuEmsRKxCMhhWn9Kg
I get the following response. Notice the types field has value of "route", but the geometry field only provides single location instead of a path.
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Darling Dr",
"short_name" : "Darling Dr",
"types" : [ "route" ]
},
{
"long_name" : "Sydney",
"short_name" : "Sydney",
"types" : [ "locality", "political" ]
},
{
"long_name" : "New South Wales",
"short_name" : "NSW",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Australia",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "2000",
"short_name" : "2000",
"types" : [ "postal_code" ]
}
],
"adr_address" : "\u003cspan class=\"street-address\"\u003eDarling Dr\u003c/span\u003e, \u003cspan class=\"locality\"\u003eSydney\u003c/span\u003e \u003cspan class=\"region\"\u003eNSW\u003c/span\u003e \u003cspan class=\"postal-code\"\u003e2000\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eAustralia\u003c/span\u003e",
"formatted_address" : "Darling Dr, Sydney NSW 2000, Australia",
"geometry" : {
"location" : {
"lat" : -33.8718136,
"lng" : 151.1984465
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "82a04f4f0548a2e7c467b71ed9c2a3a1615dac50",
"name" : "Darling Dr",
"place_id" : "ChIJ8R8rpjCuEmsRKxCMhhWn9Kg",
"reference" : "CpQBhAAAAA4dsRcdqFcTxsVmwWs1ZWWSg9XdclQgRHhLYT2XJwEIU8BOXoS3D4cM58oNhcND-bJU7k7nmLvgHZFep405LokQpkTu0yUPQtrrgNonLRVPdLy4j9Z0M7iBpmGkPN6BuDntYu6JG9urfnIJZRdIvpibFI9QxzP7uheEnJQtI7S8Aoxth99pVl5OvyySDSfn5hIQ4Nf4YLpRjiuY34ND9qvTyBoUr24qn9M1aFa6GoO46wrfW2a12DA",
"scope" : "GOOGLE",
"types" : [ "route" ],
"url" : "https://maps.google.com/maps/place?q=Darling+Dr,+Sydney+NSW+2000,+Australia&ftid=0x6b12ae30a62b1ff1:0xa8f4a715868c102b",
"vicinity" : "Sydney"
},
"status" : "OK"
}
This functionality is not supported. What you can do is create a map on MyMap and add a driving route for the path you want to highlight. Then, you can save it and export it as a KML layer. If you wanted to do this programmatically, you could use the Directions API to get the polyline for the route.
Using google place search API, I am able to find place name as shown below. However I am not able to get the address of the place.
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
alert(place.name);
If you are using the Google Place API and have the Server key for that, you can request the data from the API as follows:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=AddYourOwnKeyHere
Where the "place_id" is the parameter which is responsible for fetching out the details of that particular place. The output is in form of JSON/XML consisting of long name, short name, phone number, time, address, URL etc. You can parse the address and displace in your website/app.
For more details click this link
JSON format:
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "48",
"short_name" : "48",
"types" : [ "street_number" ]
},
{
"long_name" : "Pirrama Road",
"short_name" : "Pirrama Road",
"types" : [ "route" ]
},
{
"long_name" : "Pyrmont",
"short_name" : "Pyrmont",
"types" : [ "locality", "political" ]
},
{
"long_name" : "NSW",
"short_name" : "NSW",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "AU",
"short_name" : "AU",
"types" : [ "country", "political" ]
},
{
"long_name" : "2009",
"short_name" : "2009",
"types" : [ "postal_code" ]
}
],
"events" : [
{
"event_id" : "9lJ_jK1GfhX",
"start_time" : 1293865200,
"summary" : "<p>A visit from author John Doe, who will read from his latest book.</p>
<p>A limited number of signed copies will be available.</p>",
"url" : "http://www.example.com/john_doe_visit.html"
}
],
"formatted_address" : "48 Pirrama Road, Pyrmont NSW, Australia",
"formatted_phone_number" : "(02) 9374 4000",
"geometry" : {
"location" : {
"lat" : -33.8669710,
"lng" : 151.1958750
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "4f89212bf76dde31f092cfc14d7506555d85b5c7",
"international_phone_number" : "+61 2 9374 4000",
"name" : "Google Sydney",
"place_id" : "ChIJN1t_tDeuEmsRUsoyG83frY4",
"scope" : "GOOGLE",
"alt_ids" : [
{
"place_id" : "D9iJyWEHuEmuEmsRm9hTkapTCrk",
"scope" : "APP"
}
],
"rating" : 4.70,
"reference" : "CnRsAAAA98C4wD-VFvzGq-KHVEFhlHuy1TD1W6UYZw7KjuvfVsKMRZkbCVBVDxXFOOCM108n9PuJMJxeAxix3WB6B16c1p2bY1ZQyOrcu1d9247xQhUmPgYjN37JMo5QBsWipTsnoIZA9yAzA-0pnxFM6yAcDhIQbU0z05f3xD3m9NQnhEDjvBoUw-BdcocVpXzKFcnMXUpf-nkyF1w",
"reviews" : [
{
"aspects" : [
{
"rating" : 3,
"type" : "quality"
}
],
"author_name" : "Simon Bengtsson",
"author_url" : "https://plus.google.com/104675092887960962573",
"language" : "en",
"rating" : 5,
"text" : "Just went inside to have a look at Google. Amazing.",
"time" : 1338440552869
},
{
"aspects" : [
{
"rating" : 3,
"type" : "quality"
}
],
"author_name" : "Felix Rauch Valenti",
"author_url" : "https://plus.google.com/103291556674373289857",
"language" : "en",
"rating" : 5,
"text" : "Best place to work :-)",
"time" : 1338411244325
},
{
"aspects" : [
{
"rating" : 3,
"type" : "quality"
}
],
"author_name" : "Chris",
"language" : "en",
"rating" : 5,
"text" : "Great place to work, always lots of free food!",
"time" : 1330467089039
}
],
"types" : [ "establishment" ],
"url" : "http://maps.google.com/maps/place?cid=10281119596374313554",
"vicinity" : "48 Pirrama Road, Pyrmont",
"website" : "http://www.google.com.au/"
},
"status" : "OK"
}
Hope this would help!!
In my data I have found many examples like the following. If you search Google for "Cheyney University PA", you get the following information:
Address: 1837 University Cir, Cheyney, PA 19319
Phone: (610) 399-2000
However, when doing a search using the following:
my $pid_url = Mojo::URL->new('https://maps.googleapis.com/maps/api/place/textsearch/json');
$pid_url->query({query => $query, key => 'removed'});
my $place_id = $ua->get($pid_url)->res->json->{results}->[0]->{place_id};
# Query = https://maps.googleapis.com/maps/api/place/textsearch/json?query=Cheyney+University+PA&key=removed
# Place ID returned = ChIJ5wiPkSvuxokR2rwaVUTMwks
$deets_url = Mojo::URL->new('https://maps.googleapis.com/maps/api/place/details/json');
$deets_url->query({placeid => $place_id, key => 'removed'});
say $ua->get($deets_url)->res->body;
I get the following back from Google:
{
"result" : {
"address_components" : [
{
"long_name" : "Cheyney",
"short_name" : "Cheyney",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Thornbury",
"short_name" : "Thornbury",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Delaware County",
"short_name" : "Delaware County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Pennsylvania",
"short_name" : "PA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Cheyney, PA, USA",
"name" : "Cheyney",
"place_id" : "ChIJ5wiPkSvuxokR2rwaVUTMwks",
"scope" : "GOOGLE",
"types" : [ "locality", "political" ],
"url" : "https://maps.google.com/maps/place?q=Cheyney,+PA,+USA&ftid=0x89c6ee2b918f08e7:0x4bc2cc44551abcda",
"vicinity" : "Cheyney"
},
"status" : "OK"
}
(I removed some of the output for clarity.) Notice that in the results the street address components are missing (1837 University Cir), as well as the phone number. I have found many instances like this, and I am trying to figure out why my queries are not returning the same results as what I get when I Google the information.
Here's another example:
Google Results:
Address: 1320 S Dixie Hwy, Coral Gables, FL 33124
Phone: (305) 284-2211
Places API Results:
{
"html_attributions" : [],
"results" : [
{
"formatted_address" : "University of Miami, Coral Gables, FL 33146, USA",
"geometry" : {
"location" : {
"lat" : 25.7216374,
"lng" : -80.2792843
},
"viewport" : {
"northeast" : {
"lat" : 25.7316894,
"lng" : -80.26327689999999
},
"southwest" : {
"lat" : 25.7115846,
"lng" : -80.29529169999999
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "7eb529034293a6eb760e990e034a4314d83edcf7",
"name" : "University of Miami",
"place_id" : "ChIJn9K4n_C32YgRqR37uAXB5IM",
"reference" : "CqQBnAAAACffq3Xp3JUFowUDlEsge90htrhAoUES9tGmsB919iNQCxgldtq4khP4f_gCAju90qGY1IEUH52hZl_GP_H6xJC5z22EceCfprWEHFhhXKsW23Y9EeV24svXC-PRYnOyQaXZmbQFCeUlsmKWB6570e-8W_w31muZKwFd4hVPdeeqO45zH2zp7CAuSrHjBr0bSiOQufEB59ibxG4QcuwenSASEHvq1xMcCCtMUsFcyLYsrOIaFN0vg6S680hJay1jDSrZ686Mt9Gn",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
}
],
"status" : "OK"
}
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "University of Miami",
"short_name" : "University of Miami",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
},
{
"long_name" : "Coral Gables",
"short_name" : "Coral Gables",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Miami-Dade County",
"short_name" : "Miami-Dade County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Florida",
"short_name" : "FL",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "33146",
"short_name" : "33146",
"types" : [ "postal_code" ]
}
],
"adr_address" : "University of Miami, \u003cspan class=\"locality\"\u003eCoral Gables\u003c/span\u003e, \u003cspan class=\"region\"\u003eFL\u003c/span\u003e \u003cspan class=\"postal-code\"\u003e33146\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eUSA\u003c/span\u003e",
"formatted_address" : "University of Miami, Coral Gables, FL 33146, USA",
"geometry" : {
"location" : {
"lat" : 25.7216374,
"lng" : -80.2792843
},
"viewport" : {
"northeast" : {
"lat" : 25.7316894,
"lng" : -80.26327689999999
},
"southwest" : {
"lat" : 25.7115846,
"lng" : -80.29529169999999
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "7eb529034293a6eb760e990e034a4314d83edcf7",
"name" : "University of Miami",
"place_id" : "ChIJn9K4n_C32YgRqR37uAXB5IM",
"reference" : "CqQBlAAAAFeKC7LbGqAr7-LnBXMqbMIhuyuUh22XBMRO11hADojDclomC-InGocKSStmZ8S-S1UVWC1qHAsZi3XSp7PiDOFBgZVMqhm5kr87CfEAJmPdwsmZ6VEg5FxXh5LZmSSZdFgH0UR0OVGLL5M17SmWZp4W3Die8UNa5yCMyV5CP0T0VWmvqCb54qJR6mlyIx1itiLzRp1XhTs8_UmEt9pjIkYSEGrAqS6TWo2G1WBOrDO0YSAaFO4FfqvmFabJLia36vKL0XTz23Mu",
"scope" : "GOOGLE",
"types" : [ "sublocality_level_1", "sublocality", "political" ],
"url" : "https://maps.google.com/maps/place?q=University+of+Miami,+Coral+Gables,+FL+33146,+USA&ftid=0x88d9b7f09fb8d29f:0x83e4c105b8fb1da9",
"vicinity" : "University of Miami"
},
"status" : "OK"
}
It looks like you are wanting to use Google Maps to do some sort of address validation and parsing. The short story is, unfortunately Google Maps cannot be replied upon to return parsed address components consistently. What Google Maps does do really well is geocode - that is translate input into lat/long to be displayed on a map. You could perhaps try reverse geocoding (i.e. giving Google lat/long) to see what that returns, but I'm pretty sure you will get similar results.
I have also wanted and tried in vain to use Google Maps similarly in the past myself. After much testing against various international, real world datasets, I concluded that Google couldn't be used for validation any more than (a) getting lat/long (b) a general yes/no that address sort of looks ok. I have also tried some other Geocoding providers and later settled on GeocodeFarm when Google proved too expensive once my sites outgrew what they previously provided for free. My general conclusion was the same though - I had to stick to fairly traditional address data entry forms without 'fullproof' validation, otherwise users would be told addresses were faulty that were actually valid. GeocodeFarm did "pretty print" localized addresses quite well though (i.e. almost suitable for putting as a mailing label on an envelope), but it wasn't parsed into components for storage into a typical relational database schema.
Doing some more research to verify my own experiences, I found this and this to be useful. These links also point towards a service called 'SmartyStreets' - I cannot vouch for it however, and have zero experience with it.
Hope that helps!