zoom map to city with city name google map developer code example
Example: zoom map to city with city name google map developer
var map;
function initMap() {
var geocoder = new google.maps.Geocoder();
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 0, lng: 0},
zoom: 8
});
geocoder.geocode({'address': "Paris"}, function(results, status) {
if (status === 'OK') {
map.setCenter(results[0].geometry.location);
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}