arcgis api for JavaScript發布切片,地圖不顯示__Java

來源:互聯網
上載者:User

    按照arcgis api for JavaScript4.6官方網站提供的方法進行嘗試,ArcServer10.1發布的地圖本地也能訪問,但是一放在HTML中,用TileLayer方法,就是無法擷取到地圖。無奈嘗試使用官方提供的例子中的REST URL進行嘗試,發現成功,於是猜測問題出現在ArcServer發布出現問題,進行搜尋和嘗試,終於發現問題:在發布過程中,選擇了預設的設定,沒有進行緩衝處理,於是參考資料進行處理,詳見http://makaidong.com/dwf07223/6667_923346.html。如下:


    之後重新運行HTML,發現成功顯示發布的地圖,代碼如下(註:本人用的本地api,可根據自己需要選擇線上API):

<!DOCTYPE html><html><head>    <meta charset="UTF-8">    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">    <link rel="stylesheet" href="http://localhost:8080/firstmap/arcgis_js_api/4.2/dijit/themes/claro/claro.css" />    <link rel="stylesheet" href="http://localhost:8080/firstmap/arcgis_js_api/4.2/esri/css/main.css">    <script src="http://localhost:8080/firstmap/arcgis_js_api/4.2/init.js"></script>    <title>add tilelayer</title>    <style>        html,        body,        #viewDiv {            padding: 0;            margin: 0;            height: 100%;            width: 100%;        }    </style>    <script>        require([    "esri/Basemap",            "esri/Map",            "esri/views/MapView",            "esri/layers/TileLayer","dojo/domReady!"        ], function(            Basemap,Map,MapView,TileLayer        ) {            var tilelayer = new TileLayer({                url: "http://localhost:6080/arcgis/rest/services/qiepian/riverarea/MapServer"            });            // Add layer to map    var customBasemap = new Basemap({              baseLayers: [tilelayer],              title: "Custom Basemap",              id: "myBasemap"          });            var map = new Map({            basemap: customBasemap            });            map.add(tilelayer);            var view = new MapView({                map: map,                container: "viewDiv",                center: [104.286, 29.942],                zoom: 1            });        });    </script></head><body>    <div id="viewDiv"></div></body></html>

效果如下:



    

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.