当前位置:编程学习 > CGI >>

ARCGIS jsapi 添加级别限制

一般情况下添加的地图,是没有级别限制的,根据滚轮的滑动而改变地图的级别。按照下面的jsapi中按照下面的设置可以控制图层的缩放级别。首先定义比例尺:
 

var lods = [ 
              {"level" : 0, "resolution" : 0.703125, "scale" : 295497593.05875003}, 
              {"level" : 1, "resolution" : 0.3515625, "scale" : 147748796.52937502}, 
              {"level" : 2, "resolution" : 0.17578125, "scale" : 73874398.264687508}, 
              {"level" : 3, "resolution" : 0.087890625, "scale" : 36937199.132343754}, 
              {"level" : 4, "resolution" : 0.0439453125, "scale" : 18468599.566171877}, 
              {"level" : 5, "resolution" : 0.02197265625, "scale" : 9234299.7830859385}, 
              {"level" : 6, "resolution" : 0.010986328125, "scale" : 4617149.8915429693}, 
              {"level" : 7, "resolution" : 0.0054931640625, "scale" : 2308574.9457714846} 
            ]; 

var lods = [
              {"level" : 0, "resolution" : 0.703125, "scale" : 295497593.05875003},
              {"level" : 1, "resolution" : 0.3515625, "scale" : 147748796.52937502},
              {"level" : 2, "resolution" : 0.17578125, "scale" : 73874398.264687508},
              {"level" : 3, "resolution" : 0.087890625, "scale" : 36937199.132343754},
              {"level" : 4, "resolution" : 0.0439453125, "scale" : 18468599.566171877},
              {"level" : 5, "resolution" : 0.02197265625, "scale" : 9234299.7830859385},
              {"level" : 6, "resolution" : 0.010986328125, "scale" : 4617149.8915429693},
              {"level" : 7, "resolution" : 0.0054931640625, "scale" : 2308574.9457714846}


            ];地图实例化时添加:loads参数

[ new esri.Map("mapDiv", {"logo":false,"lods":lods}); 

new esri.Map("mapDiv", {"logo":false,"lods":lods});

具体效果如下图:
\
 

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,