My Business
5.9K members online now
5.9K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Lat/Long not appearing in GMB object

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

When I submit a get request for Location 1: (accounts/107585529128349264819/locations/3452307769258026263), no lat/long field appears. However a get request for Location 2: (accounts/107585529128349264819/locations/17111859598719821490), surfaces the lat/long field. Additionally, when opening Location 1: natively in GMB, the pin appears at 0,0 but a google maps search of the location displays the correct pin.

 

This surfaced when we tried to change the address via API and received this response: 

400 Bad Request
{
"code" : 400,
"message" : "Request contains an invalid argument.",
"status" : "INVALID_ARGUMENT",
"details" : [ {
"@type" : "type.googleapis.com/google.mybusiness.v3.ValidationError",
"errorDetails" : [ {
"code" : 1100,
"field" : "address.country",
"message" : "We cannot locate the specified address. Please verify it is correct and/or drag the marker pin on the provided map to the correct location."
} ]
} ]
}

 

The location has a valid country code and If we go into GMB natively and place the pin correctly, the changes via API will then go through. 

1 Expert replyverified_user

Re: Lat/Long not appearing in GMB object

Google Employee
# 2
Google Employee

Hi @Jacob A,

 

Not every location has a LatLng object that you can retrieve by sending a GET request. Please note that the latlng field of a Location object is a pair of user-provided latitude and longitude coordinates. When creating a location, this field is ignored if the provided address geocodes successfully. This field is only returned on get requests if the user-provided latlng value was accepted during create, or latlng value was updated through the Google My Business UI. This field cannot be updated.

 

The 400 Bad Request error with the message "We cannot locate the specified address. Please verify it is correct and/or drag the marker pin on the provided map to the correct location." typically happens when the system cannot geocode the specified address. You can provide the correct latitude/longitude values in a LatLng object when creating a new location via the API to fix this error. Please also note that it’s not possible to change your listing's country once it has been set.

 

If you have already created the location and you are sending a PATCH request to update the location via the API, please use a fieldMask and confirm that the fieldMask does not include address and latlng. You can fix this geocode error through the Google My Business UI. Please read this article that includes the description of this specific error message and what you can do to fix this error and activate your listing.

 

Thanks,

Terry