0

I'm using google maps autocomplete for user to input the place. after that I do call getPlace(), from autocomplete object.

It shows the following error.

Uncaught TypeError: Object ((13.0284176, 80.23215529999993), (13.0501581, 80.2641701)) has no method 'lat' here is my code:

My code:

autocomplete = new google.maps.places.Autocomplete(g,autoc_options);
google.maps.event.addListener(autocomplete,'place_changed',function() {
  var g=autocomplete.getPlace();
  var h=new google.maps.LatLngBounds(g.geometry.viewport);
  var l=new google.maps.LatLng(g.geometry.viewport.getSouthWest());
  alert(l.toString());
});
Mosh Feu
  • 28,354
  • 16
  • 88
  • 135
user1462684
  • 91
  • 2
  • 9

1 Answers1

1

You're trying to use LatLng to create a LatLng object with an existing LatLng object.

You can reference the southwest coordinates simply changing your code to:

var l =  g.geometry.viewport.getSouthWest();

This is because getSouthWest() already returns a LatLng object.

andresf
  • 2,063
  • 1
  • 11
  • 7