Reputation: 91
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());
});
Upvotes: 0
Views: 1830
Reputation: 2061
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.
Upvotes: 1