var numzoom = map.getNumZoomLevels();
if (zoom >= numzoom) zoom = numzoom - 1;
map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);
var numzoom = map.getNumZoomLevels();
if (zoom >= numzoom) zoom = numzoom - 1;
map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);