Google map's panTo and getCenter is both for center the map position by given latitude and longitude.
panTo
- Changes the center of the map to the given
LatLng. If the change is less than both the width and height of the map, the transition will be smoothly animated.
map.panTo(new google.maps.LatLng(latitude, longitude));setCenter
- Change the center of the map to the given LatLng.
map.setCenter(new google.maps.LatLng(latitude, longitude));
where
var map = new google.maps.Map(element, mapOptions);
where
var map = new google.maps.Map(element, mapOptions);
