davivid
davivid

Reputation: 5960

Google Maps API v3 - changed in the last week or so?

I was using the following code to obtain the lat and lng values from user input. It seemed to be working fine, until just recently.

if (status == google.maps.GeocoderStatus.OK) {
    var lat = parseFloat(results[0].geometry.location.wa).toFixed(3);
    var lng = parseFloat(results[0].geometry.location.xa).toFixed(3);
    ....

Now if I console.log results[0].geometry.location I get (51.4793388, -2.5933342) { va=51.4793388, wa=-2.5933342}.

It appears as if xa has changed to va. What is the correct way to reference these values?

Upvotes: 2

Views: 596

Answers (1)

KJYe.Name
KJYe.Name

Reputation: 17169

I recently ran into the same issue on my Google Map API 3.0 application. Basically, the wa and xa variables if i remember correctly are just LatLng() variables. So you can call them this way:

results[0].geometry.location.lat().toFixed(3);
results[0].geometry.location.lng().toFixed(3);

where va = lat and wa = lng

Upvotes: 5

Related Questions