Hi,
How should i limit the current extent within the valid lat and long ?
That's when someone clicked on the world image and i want it to zoom out no further than the valid lat,long
Thanks!
Hi,
How should i limit the current extent within the valid lat and long ?
That's when someone clicked on the world image and i want it to zoom out no further than the valid lat,long
Thanks!
Kwong,
We will post some code on this when I get back from the weekend. This is a good question and we should have a really easy way either built in or simple code to lock the user to a certain extent. At the same time we may consider locking users to certain scales as well. We have built things like this for customer development projects but it deserves to be backed into our product.
David
I have a sample on how to do this with the current web edition. In a later beta we will provide these APIs server side and make them easier to call. This is only to get it to work with the current beta 1 version. The code you need to add is below and it is added in the html side of things. Note that you do not need the map control tag, I added it should you that you need to add the script section below the map for things to work correctly.
In addition to this we are also currently adding a new kind of layer that can restrict users from seeing large areas or only allowing them to see certain areas. If they venture out of those areas or scales they will see a white area or you can use a graphic to say something like "No Data".
<cc1:Map ID="Map1" runat="server" Width="800px" Height="600px">
</cc1:Map>
function restrictArea()
{
var map = Map1.GetOpenLayersMap();
map.setOptions({"restrictedExtent" : new OpenLayers.Bounds(-180 ,-90.180 ,90)});
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(restrictArea);