I'm based in USA and make a call to: http://maps.googleapis.com/maps/api/geocode/json?latlng=xxx,xxx&sensor=false and see most data in english and then this. (note; xxx is actually a real lat & lng, just removed here).
Anyone know what this is and why its here? How do I get rid of irrelevant results?
{
"address_components" : [
{
"long_name" : "サン・ホセ=サニーベール=サンタ・クララ",
"short_name" : "サン・ホセ=サニーベール=サンタ・クララ",
"types" : [ "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "United States, California, サン・ホセ=サニーベール=サンタ・クララ",
Related
I am working with Google Map API but I noticed that Google Map API and Google Map address is not showing the same address.
For example, I have the following latitude and longitude.
Lat = 3.182670
Long = 113.095663
Using Google Map API
https://maps.googleapis.com/maps/api/geocode/json?latlng=3.182670,113.095663&key=YOUR_API_KEY
I am getting this as the result
"results" : [
{
"address_components" : [
{
"long_name" : "Asian Highway 150",
"short_name" : "AH150",
"types" : [ "route" ]
},
{
"long_name" : "Bintulu",
"short_name" : "Bintulu",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Sarawak",
"short_name" : "Sarawak",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Malaysia",
"short_name" : "MY",
"types" : [ "country", "political" ]
},
{
"long_name" : "97000",
"short_name" : "97000",
"types" : [ "postal_code" ]
}
],
However when I Google Map search the same coordinates, I get the Jalan Sibiyu, 97000 Bintulu, Sarawak as the result.
https://www.google.com.my/maps/place/3%C2%B010'57.6%22N+113%C2%B005'44.4%22E/#3.18267,113.093469,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x29c434a6775850e2!8m2!3d3.18267!4d113.095663
So question is:
Why is the coordinates are the same, but I am getting differnt result?
What can I do to get the same result?
I am trying to decode an address "344 East Columbia Avenue, Pomona, 91767, CA" but it gives me Location type as Range_interpolated
{
"results" : [
{
"address_components" : [
{
"long_name" : "344",
"short_name" : "344",
"types" : [ "street_number" ]
},
{
"long_name" : "East Columbia Avenue",
"short_name" : "E Columbia Ave",
"types" : [ "route" ]
},
{
"long_name" : "Pomona",
"short_name" : "Pomona",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Los Angeles County",
"short_name" : "Los Angeles County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "91767",
"short_name" : "91767",
"types" : [ "postal_code" ]
},
{
"long_name" : "3952",
"short_name" : "3952",
"types" : [ "postal_code_suffix" ]
}
],
"formatted_address" : "344 E Columbia Ave, Pomona, CA 91767, USA",
"geometry" : {
"location" : {
"lat" : 34.0684616,
"lng" : -117.7472136
},
"location_type" : "RANGE_INTERPOLATED",
"viewport" : {
"northeast" : {
"lat" : 34.0698105802915,
"lng" : -117.7458646197085
},
"southwest" : {
"lat" : 34.0671126197085,
"lng" : -117.7485625802915
}
}
},
"partial_match" : true,
"place_id" : "EikzNDQgRSBDb2x1bWJpYSBBdmUsIFBvbW9uYSwgQ0EgOTE3NjcsIFVTQSIbEhkKFAoSCVf7or0HLsOAEaYT6OuR5xZiENgC",
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
Whereas on searching the same address in Google Maps, it is showing me location accurately.
Whereas on decoding "343 East Columbia Avenue, Pomona, 91767, CA" address gives me Rooftop location type.
As per Google documentation, Range_interpolated indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.
Does anyone have an idea on accuracy of the Range_interpolated location type? How much accurate location it provides in meters?
We have an autocomplete field using google maps api to automatically fill in city details fields
So using "(cities)" as type we get a list of cities matching the search fine however the data is not consistent and it's large Australian cities that are missing things like postal_code field. Lookup as below
this.autocomplete = new google.maps.places.Autocomplete((this.element), { types: ["(cities)"] , componentRestrictions: {country: ["au","nz"]}});
So when searching on city such as a suburb like "Richmond" you get the following response
/**/_xdc_._n1gyyx && _xdc_._n1gyyx( {
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Richmond",
"short_name" : "Richmond",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Yarra City",
"short_name" : "Yarra",
"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" : "3121",
"short_name" : "3121",
"types" : [ "postal_code" ]
}
],
with "postal_code" and "locality", "political"
However searching on Melbourne you'd expect details with postcode 3000 however you only get
/**/_xdc_._ntt86i && _xdc_._ntt86i( {
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Melbourne",
"short_name" : "Melbourne",
"types" : [ "colloquial_area", "locality", "political" ]
},
{
"long_name" : "Victoria",
"short_name" : "VIC",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Australia",
"short_name" : "AU",
"types" : [ "country", "political" ]
}
],
So now name is stored in "colloquial_area", "locality", "political" and there's no "postal_code"
But when filtering on Melbourne in the autocomplete all you get is that Melbourne option or Melbourne airport of which neither is correct. If you then change types to "(regions) you can search on postcode which does return the correct Melbourne version.
Has anyone encountered this and worked out a way to force the filtered results to show only versions with a postcode?
This behavior is working as intended, because places like Melbourne have multiple postal code inside its area (e.g. 3977, 3156, 3806, 3978, etc.), therefore, results will not return postal code as it is not made to handle multiple postal codes and cannot return single postal code as it will affect the integrity of the information because it will not be applicable for the rest of the postal codes.
You may file a Feature Request in the Issue Tracker to request for this kind of capability in handling multiple postal codes.
I am trying to parse Google Places JSON provided when I call its API. My Problem is that I need to get address data in separate.
For example:
{
"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" ]
}
], ......
I need to get the postal_code, so I could use the Jason Path $.result.address_components[5].long_name, but sometimes the Json doesn't have the street_number, or the route and in these cases, I get the wrong data or null.
What I need is a way to get the long_name where the level's type is postal_code using Xpath (because I using Pentaho to parse it and this is the way it works).
Thanks in advance.
You'll likely need a couple of JSON Input steps, one to get the individual address components (and the types inside), and one to get the long_name:
The Filter Rows step will pick the right one(s) by type, then the last JSON Input will get you the fields from the one(s) you want. Here's a Gist with your sample input:
https://gist.github.com/mattyb149/0ceea5d7e33ae86782e0
Let me know if you have any questions, issues, etc. Cheers!
We are making requests to Google to get the coordinates and the country for specific cities and hotels.
We are using the autocomplete and for example:
"Amsterdam, The Netherlands"
We get the location reference = CkQyAAAAWv8eQqe4JnyaX6oGHP8SIq6eGIUrN6Jx8dFsOEcDn7OCLIRR-ZxucR5jg8P-FJtm6fgFkOjhxAUfzE6JL8un5xIQcN_hKzWaS6pUVCyt5xAjghoU1jfArNwwQRbTiu_ZxwBTzlnZr9Q
We make a call again to Google to get the coordinates and the country. This is the link
https://maps.googleapis.com/maps/api/place/details/json?reference=CkQyAAAAWv8eQqe4JnyaX6oGHP8SIq6eGIUrN6Jx8dFsOEcDn7OCLIRR-ZxucR5jg8P-FJtm6fgFkOjhxAUfzE6JL8un5xIQcN_hKzWaS6pUVCyt5xAjghoU1jfArNwwQRbTiu_ZxwBTzlnZr9Q&sensor=false&key=[KEY]
We get this response
{
"long_name" : "Amsterdam",
"short_name" : "Amsterdam",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Government of Amsterdam",
"short_name" : "Government of Amsterdam",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "North Holland",
"short_name" : "NH",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "The Netherlands",
"short_name" : "NL",
"types" : [ "country", "political" ]
}
We take the country by "long_name" : "The Netherlands" and we are happy but there comes this case:
We are using autocomplete for "Hotel luxer"
We get the location reference = ClRFAAAAzuaZS1YQuJOjjO3NH2rDIDrrJyiiyvmGVF90-WdZB-_mpjROO-a322bJQHYRRGVQTySPcCmpmgHYXCH9-useDg_EeRSX1tL9Igz9e1TuYcISEELfMqkiKHE5BuR7i3Y6fMYaFMXY5fk_psERzpGHesrRJhnO5gPl
We make the call again to Google, here is the link:
https://maps.googleapis.com/maps/api/place/details/json?reference=ClRFAAAAzuaZS1YQuJOjjO3NH2rDIDrrJyiiyvmGVF90-WdZB-_mpjROO-a322bJQHYRRGVQTySPcCmpmgHYXCH9-useDg_EeRSX1tL9Igz9e1TuYcISEELfMqkiKHE5BuR7i3Y6fMYaFMXY5fk_psERzpGHesrRJhnO5gPl&sensor=false&key=[KEY]
This is the response
{
"long_name" : "11",
"short_name" : "11",
"types" : [ "street_number" ]
},
{
"long_name" : "Warmoesstraat",
"short_name" : "Warmoesstraat",
"types" : [ "route" ]
},
{
"long_name" : "Amsterdam",
"short_name" : "Amsterdam",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Netherlands",
"short_name" : "NL",
"types" : [ "country", "political" ]
},
{
"long_name" : "1012 HT",
"short_name" : "1012 HT",
"types" : [ "postal_code" ]
}
We get the "long_name" : "Netherlands", even if the original autocomplete was with "The Netherlands".
Is there any option that we can set to be sure that we get a default name for the country?