當前位置:
首頁 >
ArcGIS Server 开发之鹰眼地图的实现
發布時間:2025/7/14
54
豆豆
生活随笔
收集整理的這篇文章主要介紹了
ArcGIS Server 开发之鹰眼地图的实现
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
鷹眼簡單點說就是地圖的聯動,鷹眼的全稱是OverviewMap,在ERSI提供的API包中,在dijit中進行類的調用。查了很多的資料,總結一下:
具體的代碼:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>鷹眼和比例尺</title> <!-- <link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css"> <script src="http://js.arcgis.com/3.7/"></script>--><!--<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.11/3.11/dijit/themes/tundra/tundra.css"/>--><link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.11/3.11/esri/css/esri.css" /><script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.11/3.11/init.js"></script><script src="dojo/jsapi_vsdoc12_v38.js"></script><style> html, body, #map {height: 100%;width: 100%;margin: 0;padding: 0;overflow-x: hidden; } #BasemapToggle {position: absolute;top: 20px;right: 20px;z-index: 50; } #HomeButton {position: absolute;top: 95px;left: 20px;z-index: 50; } </style><script>//引入需要的類 dojo.require("esri.map");dojo.require("esri.dijit.BasemapToggle");dojo.require("esri.dijit.HomeButton");dojo.require("esri.dijit.OverviewMap");dojo.require("esri.dijit.Scalebar");//定義全局變量var map;//準備初始化 dojo.ready(init);//初始化方法function init() {//創建地圖 map = new esri.Map("map", {center: [121.48, 31.25],zoom: 8,basemap: "streets"});//衛星圖切換 var toggle = new esri.dijit.BasemapToggle({map: map,basemap: "satellite"}, "BasemapToggle");toggle.startup();//HOME按鈕var home = new esri.dijit.HomeButton({map: map}, "HomeButton");home.startup();//比例尺var scalebar = new esri.dijit.Scalebar({map: map,attachTo: "bottom-right",width:10,// "dual" displays both miles and kilmometers// "english" is the default, which displays miles// use "metric" for kilometers scalebarUnit: "dual"});//鷹眼小地圖var overviewMap = new esri.dijit.OverviewMap({map: map,visible: true, // 初始化可見,默認為false attachTo: "bottom-left", // 默認右上角 width: 250, // 默認值是地圖高度的 1/4th height: 150, // 默認值是地圖高度的 1/4th opacity: 0.5, // 透明度 默認0.5 maximizeButton: true, // 最大化,最小化按鈕,默認false expandFactor: 2, //概覽地圖和總覽圖上顯示的程度矩形的大小之間的比例。默認值是2,這意味著概覽地圖將至少是兩倍的大小的程度矩形。 color: "#000000" // 默認顏色為#000000 });overviewMap.startup();}</script> </head> <body><div id="map"><div id="BasemapToggle"></div><div id="HomeButton"></div></div> </body> </html>運行截圖:
?
轉載于:https://my.oschina.net/dongteng/blog/684435
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的ArcGIS Server 开发之鹰眼地图的实现的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CSS使图片变灰
- 下一篇: nginx-tomcat负载均衡redi