Thanks for your reply Rahul M
On 29 Sep, 11:47, Andrew Leach <andrew.leac...@gmail.com> wrote: > On 29 September 2010 11:11, Rahul Mehta <mehta.rahu...@googlemail.com> wrote: > > > Hi Andrew, > > > It works but it zooms out and in at some other location not the area > > selected. > > Mike's example uses the map's centre and checks whether that is within > the range. At higher zooms, there will be less of the map visible > "outside" the centre-point. So what you could do is check that the > four corners of the map are within the range you want. > > You can do two fairly easily with map.getBounds().getSouthWest() and > map.getBounds().getNorthEast(), so one challenge will be to work out > northwest and southeast. > > Finding the nearest allowed point is another layer of complication, > since the required point to which to move the map -- you have to use > setCenter() -- is different for different zoom levels, as as close > zooms you will need to centre to a point nearer to the edge than you > do for distant zooms. > > One solution would be to work out the allowable range for different > zooms, and then use the applicable range to do the calculations. > Working out each range can be done by trial and error, and you could > store them in an array by zoom level for easy access > > myAllowedRange[12]=new GLatLngBounds(...); > myAllowedRange[13]=new GLatLngBounds(...); //etc > > Check against myAllowedRange[map.getZoom()] > > > Sorry i cannot supply link as i dont have server to upload. > > Too bad. -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to google-maps-...@googlegroups.com. To unsubscribe from this group, send email to google-maps-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.