Stack Exchange
On failed Geocoding map is not setting to supplied coordinates
I am initializing the Google map using following code:
function googleMapinitialize(fenceAddIn){
var fenceAdd=new google.maps.LatLng(37.2146,121.5545);
var mapProp = {
        center:fenceAdd,
        zoom:30,
        mapTypeId:google.maps.MapTypeId.TERRAIN
};

var map = new google.maps.Map(document.getElementById("fenceMap"),mapProp);

var geocoder = new google.maps.Geocoder();
var location = fenceAddIn; //"2001 Gateway PI, San Jose, CA";

if(!geocoder) {
    geocoder = new google.maps.Geocoder();
}

var geocoderRequest = {
    address: location
}

var myCity = null;
var marker = null;
var infowindow = null;
geocoder.geocode(geocoderRequest, function(results, status) {
    if (status =="" || status == google.maps.GeocoderStatus.ZERO_RESULTS){
        alert("'" + location + "' not found!!!");
        map.setCenter(fenceAdd);
    } else if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        fenceAdd = new google.maps.LatLng(results[0].geometry.location.hb,results[0].geometry.location.ib);
        if (!marker) {
            marker = new google.maps.Marker({
                map: map,
                raiseOnDrag:false,
                draggable:true
            });
            marker.setPosition(results[0].geometry.location);
            google.maps.event.addListener(marker,'click',function(){
                if (!infowindow) {
                  infowindow = new google.maps.InfoWindow({
                      disableAutoPan:true,
                      maxWidth:100
                  });
                }
                var content = '<strong>' + results[0].formatted_address + '</strong>';
                infowindow.setContent(content);
                infowindow.setPosition(results[0].geometry.location);
                infowindow.open(map, marker);                   
            });

        }
    }
    myCity = new google.maps.Circle({
        center:fenceAdd,
        radius:125,
        strokeColor:"#0000ff",
        strokeOpacity:0.1,
        strokeWeight:0.1,
        fillColor:"#0000ff",
        fillOpacity:0.20,
        map:map
    });

    google.maps.event.addListener(map, 'click', function(){
        infowindow.close();
    });
    google.maps.event.addListener(map, 'dblclick', function(){
        window.open("<%=request.getContextPath() %>/jsp/googleMapPopup.jsp?fenceAddress="+$('#haddr').val(),'ADDRESSMAP','height=400,width=600');
    });
});
}

I am sending a address which is geocoded and the position marked by a pin on the map. But in case when the geocoding fails the map is centered around china. So to overcome this I am resetting the map center to the original lat long and drawing the circle on it. When I debugged the code I saw that the coordinates are getting set properly but the map is still showing the china map.
Can some tell me how to reset the map location in this case? 

Your fenceAdd coordinates default to China:

206 Provincial Road, Muping, Yantai, Shandong, China (37.21401, 121.5955285)

If you don't want the map to center there, change those coordinates.
