Restrict Zoom and movements?

Hello,

I Have a question is it possible thru OSM and OpenLayer to ristrict the zoomLevel and the movement of a map.

For example I want that a user only can see one country and only can use the zoomLeve 8-20. So he can’t see the whole world map and move around.

with regards

Yes, it’s possible. The example below shows a restricted extent which covers the entire planet but you can define smaller areas. The URL below that discusses restricting zoom out.

OpenLayers examples: RestrictedExtent
Nabble - OpenLayers Users - Preventing zoom out

Thank you, works.

Hi Robert - can you post your example, perhaps? I knocked together something here where the restrictedextent worked OK, but I couldn’t work out how to restrict the zoom range to between 11 and 17 as the bit of the quoted example I looked at seemed to be Google specific. I’m sure it will help others if you do.

You’re welcome Roger. I second Ed’s suggestion, it would be good to see your example, if you don’t mind.

@EdLoach sorry the PreventingZoomOut also didn’t work either, because I use my own tiles and so I can’t use MIN_ZOOM_LEVEL. I use my own zoomFunction() thru a javascript function. I disabled the navigation.

Thanks for the update. Useful to know.
Apologies for getting your name wrong in my last post, Robert.