First, this question is suited to the user's list not the developer's list. The developer's list is for questions or discussions about developments in the actual OpenLayers library, not using OpenLayers for development.
Second, You can just set the restricted extent directly on the layers of interest once the selection is made Thirdly if you want to precisely control things yourself you can listen to and react to the map's 'movestart' & 'moveend' events. and also the 'move' event if you want finer control. Cache the location when movestart fires Test the current location (extent, zoom, etc) as move or moveend fires If using move event, then if the location is within the limit then change the cached location to the current location When moveend fires, if the map is outside of the acceptable bounds for the area you are focusing on, then move it back to the cached location programattically (ie map.setCenter(....) ) Matt Priour Kestrel Computer Consulting From: openlayers-dev-requ...@lists.osgeo.org Sent: Thursday, May 26, 2011 11:00 AM To: openlayers-dev@lists.osgeo.org Subject: Dev Digest, Vol 56, Issue 28 Send Dev mailing list submissions to openlayers-dev@lists.osgeo.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.osgeo.org/mailman/listinfo/openlayers-dev or, via email, send a message with subject or body 'help' to openlayers-dev-requ...@lists.osgeo.org You can reach the person managing the list at openlayers-dev-ow...@lists.osgeo.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev digest..." Message: 1 Date: Wed, 25 May 2011 09:04:55 -0700 From: "Mark K. Zanfardino" <mzanfard...@gmail.com> Subject: [OpenLayers-Dev] How to dynamically set maxExtent and restrictedExtent To: OpenLayers-Dev Dev <d...@openlayers.org> Message-ID: <4ddd28a7.9080...@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed What I'm trying to do: I'm rending a map for an entire county. I have a simply html select option of extents that I wish to use to set focus on the map. I need to restrict the user from being able to zoom 'out' (pull back and see the entire county) or slide 'away' (drag the map to another area) after an option has been selected. I currently initialize the map to the county view when the page loads (see http://pastebin.com/jSmnHtwS for HTML). I have written a function which will zoom to a new extent based on the selection of the option list (see http://pastebin.com/WBX0rmxz for JavaScript). All this works fine, but I'm stuck with how I can restrict the user from zooming 'out' or slipping 'away' from the focused extent. I'm looking for any suggestions on what might be the best approach to achieve my objective. Thanks, Mark Zanfardino PS - My apologies if this shows up as a duplicate. I received a notice that the first email I sent was quarantined do to the attachment of the javascript) ------------------------------
_______________________________________________ Dev mailing list d...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-dev