Automatically Finding Appropriate Zoom
I'm using Google Maps and Google Geocoding service for my location service application. I use Google Geocoding service for translating address to lat/lng position. My problem is how to automatically find an appropriate zoom for a certain address like the maps.google.com does.

For example, when I search a street in maps.google.com (e.g. `Cisitu Baru, Bandung`), it will show the street in smaller zoom. When I search a region (e.g. `Bandung`), it will show larger zoom. And a larger zoom for province (e.g. `Jawa Barat` / `West Java`), and so on.

I have tried both

	var geocoder = new google.maps.Geocoder();
	geocoder.geocode( {
		'address': someAddress
	}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			console.dir(results);
			//cut
			map.panToBounds(results[0].geometry.bounds); //setting bound
			//cut
		}
	});

and 

	//cut
	map.panToBounds(results[0].geometry.viewports); //setting bound
	//cut

(Honestly, I still don't know what's the difference between `bounds` and `viewport` and what are their uses from code.google.com/apis/maps/documentation/javascript/geocoding.html)

but both still don't display the map in appropriate zoom.

Right now, I use a small hack like this

	var tabZoom =  {
		street_address: 15,
		route: 15,
		sublocality: 14,
		locality: 13,
		country: 10
	};
	//cut
	map.setCenter(results[0].geometry.location);
	if (tabZoom[results[0].types[0]] != undefined){
		map.setZoom(tabZoom[results[0].types[0]]);
	} else {
		map.zetZoom(10);
	}
	//cut

Is there other solution? (Or anything from Google Map API that I don't know yet?)

Thanks!

Automatically Finding Appropriate Zoom
===

I'm using Google Maps and Google Geocoding service for my location service application. I use Google Geocoding service for translating address to lat/lng position. My problem is how to automatically find an appropriate zoom for a certain address like the maps.google.com does.

For example, when I search a street in maps.google.com (e.g. `Cisitu Baru, Bandung`), it will show the street in smaller zoom. When I search a region (e.g. `Bandung`), it will show larger zoom. And a larger zoom for province (e.g. `Jawa Barat` / `West Java`), and so on.

I have tried both

	var geocoder = new google.maps.Geocoder();
	geocoder.geocode( {
		'address': someAddress
	}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			console.dir(results);
			//cut
			map.panToBounds(results[0].geometry.bounds); //setting bound
			//cut
		}
	});

and 

	//cut
	map.panToBounds(results[0].geometry.viewports); //setting bound
	//cut

(Honestly, I still don't know what's the difference between `bounds` and `viewport` and what are their uses from code.google.com/apis/maps/documentation/javascript/geocoding.html)

but both still don't display the map in appropriate zoom.

Right now, I use a small hack like this

	var tabZoom =  {
		street_address: 15,
		route: 15,
		sublocality: 14,
		locality: 13,
		country: 10
	};
	//cut
	map.setCenter(results[0].geometry.location);
	if (tabZoom[results[0].types[0]] != undefined){
		map.setZoom(tabZoom[results[0].types[0]]);
	} else {
		map.zetZoom(10);
	}
	//cut

Is there other solution? (Or anything from Google Map API that I don't know yet?)

Thanks!
