This is a migrated thread and some comments may be shown as answers.

Limit Map Area

3 Answers 87 Views
Map
This is a migrated thread and some comments may be shown as answers.
Ryad
Top achievements
Rank 1
Ryad asked on 06 May 2015, 09:08 AM

Hi,

 I have a special need where I want to limit the user to see only a specific zone of the map and nothing except that zone. for example he just can see France country and nothing outside that area.

Is there a way to set this by coding?

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 08 May 2015, 05:43 AM
Hi Ryad,

You can just disable the panning and the zooming:

<telerik:RadMap runat="server" ID="RadMap1" Pannable="false" Zoomable="false"></telerik:RadMap>

And just to configure RadMap to show France, or whatever is needed via the Center's Longitude and L attitude properties.

Regards,
Ianko
Telerik
0
Ryad
Top achievements
Rank 1
answered on 08 May 2015, 07:37 AM

Hello lanko,

Thanks for the tip, I'll give it a try, it looks interesting.

Do you know if possible to apply a code like the one in the below link (this is exactly what I want):

https://www.mapbox.com/mapbox.js/example/v1.0.0/maxbounds/

0
Ianko
Telerik team
answered on 08 May 2015, 08:09 AM
Hello,

Yes, the suggestion below leads almost to the same beahvior.

Additionally, you can configure the MinZoom and MaxZoom values with some suitable values.
<telerik:RadMap runat="server" ID="RadMap1"  Width="600px" Height="400px"
    Zoomable="false" Pannable="false" Zoom="8" MinZoom="6" MaxZoom="10">
    <CenterSettings Latitude="40.712" Longitude="-74.227" />
    <LayersCollection>
        <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
            UrlTemplate="http://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png"
            Attribution="© <a href='http://osm.org/copyright' title='OpenStreetMap contributors' target='_blank'>OpenStreetMap contributors</a>.">
        </telerik:MapLayer>
    </LayersCollection>
</telerik:RadMap>



Regards,
Ianko
Telerik
Tags
Map
Asked by
Ryad
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Ryad
Top achievements
Rank 1
Share this question
or