ThinkGeo.com    |     Documentation    |     Premium Support

Map RestrictedExtent same as Google Map

Hi,
I want to restrict whole map(countries02.shp) with up to some zoom level. No further level will be move.
i mean it should be like ‘Google Map’. In google map, wrap is working but zoom out was restricted to particular zoom.

I tried by setting min and max zoomlevel.
code:

    function OnOverlaysDrawing(layers) {
        for (var index = 0; index < layers.length; index++) {
            var templayer = layers[index];
            if (templayer.id == "World Map") {
                templayer.MIN_ZOOM_LEVEL = 10;
                templayer.MAX_ZOOM_LEVEL = 20;
            }
        }
    }

here i am attaching my sample application.
RestrictedExtent.zip (1.6 KB)

Can you please give me some code to restrict our map(countries02.shp).

Thanks,
Riyaz

Hi Riyaz,

The solution is, build custom zoomlevel, only add the scale from 10 to 20, this can limit the zoom level.

And you can set the RestrictedExtent, which can limit the pan.

We have a old sample here about this API:

http://wiki.thinkgeo.com/wiki/map_suite_desktop_edition_all_samples#restricting_extent

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,
Thanks for your reply.
The sample url, you have sent is for desktop edition.That logic is working based on ‘winformsMap1_CurrentExtentChanging’ event. but this event is not available in Web Edition.

So please provide me some other solution to fix this.

Thanks,
Riyaz

Hi Riyaz,

If that’s not helpful for the web edition, please just set the RestrictedExtent for your map.

Regards,

Ethan