Is there a was of automatically setting the zoom level based on the size of the country that the map has been centered on?
maps.google.com does exactly what I need,
If you don't use google maps api and just use their geocoding you can use this formula:
var url = 'http://maps.google.com/maps/geo?q=YOUR_QUERY&output=json&oe=utf8&sensor=false&key=YOUR_KEYback=geoCodeDone';
jQuery.getScript(url);
function geoCodeDone(data)
{
if (data.Status.code == 200)
{
lng = data.Placemark[0].Point.coordinates[0];
lat = data.Placemark[0].Point.coordinates[1];
var east = data.Placemark[0].ExtendedData.LatLonBox.east;
var west = data.Placemark[0].ExtendedData.LatLonBox.west;
var zoom = 11 - Math.round(Math.log(Math.abs(west-east))/Math.log(2));
}
}