Does anyone know if Google Maps has any default settings in displaying the lat/lng of a search location?
I'm using the Google Maps Geocoding API to find geolocation lat/lng values for a user-inputted search address. I want to match the results to Google Maps as closely as possible - could it be as simple as always taking the first result returned by the API?
Example: If I search "Kassel" in Google Maps, lat/lng results are 51.3149724,9.3904035.
Google Maps result for searching "Kassel"
Searching using Google API leads to two results, where the first result's location value is closer to Google Maps than the second:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Kassel",
"short_name" : "Kassel",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Kassel",
"short_name" : "KS",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Hesse",
"short_name" : "HE",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Germany",
"short_name" : "DE",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Kassel, Germany",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 51.36940509999999,
"lng" : 9.570128199999999
},
"southwest" : {
"lat" : 51.2603671,
"lng" : 9.3511015
}
},
"location" : {
"lat" : 51.3127114,
"lng" : 9.4797461
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 51.36940509999999,
"lng" : 9.570128199999999
},
"southwest" : {
"lat" : 51.2603671,
"lng" : 9.3511015
}
}
},
"place_id" : "ChIJHWx6n04_u0cRRxciWD1jhC8",
"types" : [ "locality", "political" ]
},
{
"address_components" : [
{
"long_name" : "Kassel",
"short_name" : "Kassel",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
},
{
"long_name" : "Biebergemünd",
"short_name" : "Biebergemünd",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Darmstadt",
"short_name" : "DA",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Hessen",
"short_name" : "HE",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Germany",
"short_name" : "DE",
"types" : [ "country", "political" ]
},
{
"long_name" : "63599",
"short_name" : "63599",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Kassel, 63599 Biebergemünd, Germany",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 50.2173498,
"lng" : 9.3059744
},
"southwest" : {
"lat" : 50.18299649999999,
"lng" : 9.271353399999999
}
},
"location" : {
"lat" : 50.2066898,
"lng" : 9.279060399999999
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 50.2173498,
"lng" : 9.286410699999999
},
"southwest" : {
"lat" : 50.2006739,
"lng" : 9.271353399999999
}
}
},
"place_id" : "ChIJG4zo1CMvvUcRQPWOqlJDIgo",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
}
],
"status" : "OK"
}
The only documentation around this that I could find was as follows:
Why do the Google Maps APIs Geocoders provide different locations than Google Maps? The API geocoder and Google Maps geocoder sometimes use different data sets (depending on the country). The API geocoder occasionally gets updated with new data, so you can expect to see results changing or improving over time.