<< Click to Display Table of Contents >>

 

於SuperGIS Server地圖網站中加入ArcGIS Online地圖

 

 

1.

使用記事本或其它文字編輯器開啟前一小節所建立的網站目錄下的SGSWebApp.htm檔案(預設目錄位置為C:\Inetpub\wwwroot\服務名稱),並於<script>區塊中加入引用ArcGIS Online API的程式碼(藍色粗體文字部份);

………

<script type="text/javascript" src="scripts/Overview.js"></script>

<script type="text/javascript" src="scripts/Bookmark.js"></script>

<script type="text/javascript" src="scripts/ArcGISOnline.js"></script>

………

 

 

2.

複製以下InitWnd()函式內容,並貼到SGSWebApp.htm程式碼之中;請將InitWnd()函式貼到主程式<Script>區塊中的最前面(藍色粗體部分),將其設為第一個函式(您可在此函式中,自行變更ArcGIS Online的URL連結位置);開啟後,使用蒐群功能找:

………

<script type="text/javascript" src="scripts/Bookmark.js"></script>

<script type="text/javascript" src="scripts/ArcGISOnline.js"></script>

<script>

function InitWnd()

 {

         new ArcGISOnline("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", LoadConfig);

 }

 

var gMapBase = null;

function InitWnd()

………

 

 

3.

使用搜尋功能,搜尋<body onresize="onResize();" onload="LoadConfig();">,把LoadConfig() 改為InitWnd()。

………

<body onresize="onResize();" onload="InitWnd();">

 <div id="headerNode">

         <img id="logo" src="images/SuperGeo_logo.png" />

         <h1 id="title">Title</h1>

         <div id="ToolGroup">

         </div>

 </div>

 <div id="menu">

 </div>

 <div id="mapNode">

         <img id="copyright" src="images/Copyright.png" />

         <label id="Coordinate">

         </label>

 </div>

</body>

</html>

………

 

 

4.

接著,搜尋  xmlhttp.onreadystatechange = function() ,並且加入一行宣告程式碼:

var that = this;將此變數指向InitWnd()函式中的ArcGIS Online圖層(藍色粗體文字部份)同時加入That到CreateMap中(藍字粗體部分);

………

var that = this;

           xmlhttp.onreadystatechange = function() {

               if (xmlhttp.readyState == 4) {

                   if (xmlhttp.status == 200)

                       CreateMap(xmlhttp.responseXML, that);

                   else

                       alert("Config.xml not found!");

               }

           }

………

 

 

5.

搜尋 function CreateMap(xmlDoc),改為 function CreateMap(xmlDoc,that);

..............

function CreateMap(xmlDoc, that) {

                 var pOMap = document.getElementById("mapNode");

           var cacheElem = xmlDoc.getElementsByTagName("UseCache");

.........

 

 

 

6.

最後,於加入SuperGIS Server圖層的程式碼的上方加入兩行新增pLyrA圖層到網站中的程式碼(藍色粗體文字部份)。在此請注意,先加入的圖層會放置於下層,後加入的圖層則會置於上層。

..............

          var pLyrA = that;

          pMapBase.AddLayer(pLyrA);

           

           pMapBase.AddLayer(pLyr);

           pMapBase.ZoomMapTo(pExt);

           pTrans.putMapLevel(Math.floor(pTrans.getMapLevel()));

           pTrans.FitLevel();

.........

 

 

 

7.

完成以上設定後,儲存SGSWebApp.htm,開啟網頁瀏覽器連結到SuperGIS Server網站後,便可以發現ArcGIS Online的地圖已經成功在SuperGIS Server地圖網站中顯示並套疊SuperGIS Server地圖服務圖層了。

 

 

 

 

NOTE:若您要讓行動端也可瀏覽,需將本頁上述內容改動至SGSMobileApp.htm中。

 


©2017 Supergeo Technologies Inc. All rights reserved.