ThinkGeo.com    |     Documentation    |     Premium Support

A bug with restricted layer!

Hi,


I tried this on the websamples (websamples.thinkgeo.com/webeditionsamples/Content.aspx?SampleId=RestrictedExtent&Name=Restricted%20extent)


This was one of the bugs i reported ages ago. 


If you notice, you cannot pan up and down using that websample but if you click on the world icon, other areas are displayed.


The purpose of using the restricted layer is restricting the user within the valid coordinates. This is causing problems because i am getting map data from another source and passing invalid coordinates will just crash Mapsuite.



This is a bug; we will solve it in the next release. Now to work around, we need to add the javascript function as following. Here attached is the sample code, any more queries please let us know.




<script type="text/javascript">
        var OnMapCreating = function(map){
            map.setCenter = function(lonlat, zoom, dragging, forceZoomChange) {
                if(zoom == null){
                    zoom = this.getZoom();
                }
                if(this.restrictedExtent)
                {
                    var restrictedZoom = this.getZoomForExtent(this.restrictedExtent,true);
                    if(zoom < restrictedZoom){
                        zoom = restrictedZoom;
                    }
                }
                if(zoom < this.minZoomLevel){
                    zoom = this.minZoomLevel;
                }
                this.moveTo(lonlat, zoom, {
                    'dragging': dragging,
                    'forceZoomChange': forceZoomChange,
                    'caller': 'setCenter'
                });
            }
        }
    </script>


Ben.

133-4812ForMapSuitedev.zip (93.6 KB)