国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務

這篇具有很好參考價值的文章主要介紹了arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

需求:

以arcgis js api的basetilelayer加載arcgis發(fā)布的柵格切片服務

效果圖:

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務,JS,arcgis,javascript,開發(fā)語言

其中和tileinfo和lods,這樣獲取:

https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/?f=pjson

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務,JS,arcgis,javascript,開發(fā)語言

urltemplate:

這樣獲取

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務,JS,arcgis,javascript,開發(fā)語言

https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/WMTS/1.0.0/WMTSCapabilities.xml

?

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務,JS,arcgis,javascript,開發(fā)語言

先確保以一張為例有結果返回

https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/WMTS/tile/1.0.0/ChinaOnlineCommunity/default/default028mm/14/6730/13396.png

arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務,JS,arcgis,javascript,開發(fā)語言文章來源地址http://www.zghlxwxcb.cn/news/detail-803128.html

代碼:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="initial-scale=1, maximum-scale=1, user-scalable=no"
    />
    <title>以basetilelayer加載切片服務</title>
    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <link
      rel="stylesheet"
      
    />
    <script src="https://js.arcgisonline.cn/4.25/init.js"></script>

    <script>
      require([
        "esri/Map",
        "esri/views/MapView",
        "esri/layers/BaseTileLayer",
        "esri/layers/support/TileInfo",
        "esri/geometry/SpatialReference",
        "esri/geometry/Extent",
        "esri/config",
        "esri/request",
        "esri/layers/FeatureLayer",
      ], function (
        Map,
        MapView,
        BaseTileLayer,
        TileInfo,
        SpatialReference,
        Extent,
        esriConfig,
        esriRequest,
        FeatureLayer
      ) {
        var tileInfo = new TileInfo({
          rows: 256,
          cols: 256,
          dpi: 96,
          format: "PNG",
          compressionQuality: 0,
          origin: {
            x: -2.0037508342787e7,
            y: 2.0037508342787e7,
          },
          spatialReference: {
            wkid: 102100,
            latestWkid: 3857,
          },
          lods: [
            {
              level: 0,
              resolution: 156543.03392800014,
              scale: 5.91657527591555e8,
            },
            {
              level: 1,
              resolution: 78271.51696399994,
              scale: 2.95828763795777e8,
            },
            {
              level: 2,
              resolution: 39135.75848200009,
              scale: 1.47914381897889e8,
            },
            {
              level: 3,
              resolution: 19567.87924099992,
              scale: 7.3957190948944e7,
            },
            {
              level: 4,
              resolution: 9783.93962049996,
              scale: 3.6978595474472e7,
            },
            {
              level: 5,
              resolution: 4891.96981024998,
              scale: 1.8489297737236e7,
            },
            {
              level: 6,
              resolution: 2445.98490512499,
              scale: 9244648.868618,
            },
            {
              level: 7,
              resolution: 1222.992452562495,
              scale: 4622324.434309,
            },
            {
              level: 8,
              resolution: 611.4962262813797,
              scale: 2311162.217155,
            },
            {
              level: 9,
              resolution: 305.74811314055756,
              scale: 1155581.108577,
            },
            {
              level: 10,
              resolution: 152.87405657041106,
              scale: 577790.554289,
            },
            {
              level: 11,
              resolution: 76.43702828507324,
              scale: 288895.277144,
            },
            {
              level: 12,
              resolution: 38.21851414253662,
              scale: 144447.638572,
            },
            {
              level: 13,
              resolution: 19.10925707126831,
              scale: 72223.819286,
            },
            {
              level: 14,
              resolution: 9.554628535634155,
              scale: 36111.909643,
            },
            {
              level: 15,
              resolution: 4.77731426794937,
              scale: 18055.954822,
            },
            {
              level: 16,
              resolution: 2.388657133974685,
              scale: 9027.977411,
            },
            {
              level: 17,
              resolution: 1.1943285668550503,
              scale: 4513.988705,
            },
            {
              level: 18,
              resolution: 0.5971642835598172,
              scale: 2256.994353,
            },
            {
              level: 19,
              resolution: 0.29858214164761665,
              scale: 1128.497176,
            },
          ],
        });

        var tileExtent = new Extent({
          xmin: -2.0037507067161843e7,
          ymin: -3.0240971958386254e7,
          xmax: 2.0037507067161843e7,
          ymax: 3.0240971958386205e7,
          spatialReference: {
            wkid: 102100,
          },
        });
        var MyCustomTileLayer = BaseTileLayer.createSubclass({
          properties: {
            urlTemplate: null,
          },
          getTileUrl: function (level, row, col) {
            return this.urlTemplate
              .replace("{z}", level)
              .replace("{x}", col)
              .replace("{y}", row);
          },
          fetchTile: function (level, row, col, options) {
            var url = this.getTileUrl(level, row, col);
            return esriRequest(url, {
              responseType: "image",
              allowImageDataAccess: true,
            }).then(
              function (response) {
                var image = response.data;
                var width = this.tileInfo.size[0];
                var height = this.tileInfo.size[0];
                var canvas = document.createElement("canvas");
                var context = canvas.getContext("2d");
                canvas.width = width;
                canvas.height = height;
                if (this.tint) {
                  context.fillStyle = this.tint.toCss();
                  context.fillRect(0, 0, width, height);
                  context.globalCompositeOperation = "difference";
                }
                context.drawImage(image, 0, 0, width, height);
                return canvas;
              }.bind(this)
            );
          },
        });

        var mylayer = new MyCustomTileLayer({
          urlTemplate:
            "https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/WMTS/tile/1.0.0/ChinaOnlineCommunity/default/default028mm/{z}/{y}/{x}.png",

          tileInfo: tileInfo,
        });

        var map = new Map({
          spatialReference: new SpatialReference({ wkid: 3857 }),
          basemap: {
            baseLayers: [mylayer],
          },
        });

        var view = new MapView({
          container: "viewDiv",
          map: map,
          extent: tileExtent,         
          spatialReference: new SpatialReference({ wkid: 3857 }),
        });
      });
    </script>
  </head>

  <body>
    <div id="viewDiv"></div>
  </body>
</html>

到了這里,關于arcgis javascript api4.x以basetilelayer方式加載arcgis發(fā)布的柵格切片服務的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!

本文來自互聯(lián)網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 【02】mapbox js api加載arcgis切片服務

    【02】mapbox js api加載arcgis切片服務

    第三方的mapbox js api加載arcgis切片服務,同時疊加在mapbox自帶底圖上 形如這種地址去加載: http://zjq2022.gis.com:8080/demo/loadmapbox.html arcgis切片服務參考鏈接思路:【01】mapbox js api加載arcgis切片服務-CSDN博客

    2024年01月19日
    瀏覽(26)
  • 【01】mapbox js api加載arcgis切片服務

    【01】mapbox js api加載arcgis切片服務

    第三方的mapbox js api加載arcgis切片服務,同時疊加在天地圖上,天地圖坐標系web墨卡托。 形如這種地址去加載http://zjq2022.gis.com:8080/demo/loadmapboxtdt.html 需要制作一個和天地圖比例尺級別以及切片大小等一樣的切片方案,可以通過arcmap或者arcgispro制作。如圖: 具體的切片信息參數(shù)

    2024年01月19日
    瀏覽(29)
  • ArcGIS API for JavaScript Map與地圖控件

    ArcGIS API for JavaScript Map與地圖控件

    目錄 添加網頁 引用接口 添加模塊與模塊實例 獲取API密鑰 創(chuàng)建地圖 創(chuàng)建地圖視圖 添加圖形圖層 在底圖之間切換 在圖庫中選擇底圖 默認底圖視圖(Home)控件 圖層列表(Layerlist)控件 圖例(Legend)控件 比例尺(ScaleBar)控件 指北針(Compass)控件 查看我的位置(Locate)控件

    2024年02月12日
    瀏覽(25)
  • ArcGIS API for JavaScript 4.x 實現(xiàn)動態(tài)脈沖效果

    ArcGIS API for JavaScript 4.x 實現(xiàn)動態(tài)脈沖效果

    主要通過定時刷新,每一次的脈沖渲染圈不停的放大,并且透明度縮小,直到達到一定的大小再退回0。 這個文件拿去可以直接使用,下面是引入的方式: 然后可以調用提供的方法實現(xiàn)動態(tài)點的添加,動畫的暫停和啟動。

    2024年02月09日
    瀏覽(29)
  • ArcGIS API for JavaScript 3.44 地圖Demo示例合集

    用于JavaScript的ArcGIS API是在web應用程序中嵌入地圖和任務的輕量級方法。您可以從ArcGIS Online、您自己的ArcGIS Server或其他服務器獲取這些地圖。 描述 此示例演示如何創(chuàng)建一個完整的頁面映射應用程序。此示例創(chuàng)建一個以舊金山市為中心的新地圖,并將其中一個預定義的基本地

    2024年02月13日
    瀏覽(22)
  • ArcGIS API for JavaScript 4.x 教程(一) 顯示一張地圖

    了解如何創(chuàng)建和顯示帶有基本地圖圖層的地圖。 地圖包含地理數(shù)據(jù)層。地圖包含一個基本地圖層,以及一個或多個數(shù)據(jù)層(可選)??梢允褂玫貓D視圖顯示地圖的特定區(qū)域,并設置位置和縮放級別。 本教程將向您展示如何使用地形底圖層創(chuàng)建和顯示加利福尼亞州圣莫尼卡山

    2024年02月14日
    瀏覽(18)
  • ArcGIS API for JavaScript 4.x 教程(二)切換基礎地圖圖層

    了解如何更改地圖中的基礎地圖圖層。 基礎地圖圖層: 基礎地圖層是用于訪問和顯示來自基礎地圖層服務的數(shù)據(jù)的層。它為地圖或場景提供視覺和地理上下文,通常包含具有管理邊界和地名的全局數(shù)據(jù)。 基本地圖圖層服務提供了許多基本地圖圖層樣式,例如地形、街道和圖

    2024年02月14日
    瀏覽(18)
  • arcgis js 4.x加載地圖服務跨域配置(.Net方式)

    1.配置DotNet文件下的proxy文件 ?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\" ? ProxyConfig allowedReferers=\\\"*\\\" ? ? ? ? ? ? ?mustMatch=\\\"true\\\" xmlns=\\\"proxy.xsd\\\" ? ? serverUrls ? ? ? ? serverUrl url=\\\"http://ip:port/arcgis/rest/services\\\" ? ? ? ? ? ? ? ? ? ?matchAll=\\\"true\\\"/ ? ? /serverUrls /ProxyConfig !-- See https://github.com/Esri/resourc

    2024年01月19日
    瀏覽(18)
  • ArcGIS API for JavaScript 4.x 教程(四) 添加點、線和多邊形

    了解如何在地圖中顯示點、線和多邊形圖形。 圖形是用于在地圖或場景中顯示點、線、多邊形和文本的視覺元素。圖形由幾何圖形、符號和屬性組成,單擊時可以顯示彈出窗口。您通常使用圖形來顯示未連接到數(shù)據(jù)庫(即GPS位置)的地理數(shù)據(jù)。 在本教程中,您將學習如何將

    2024年02月13日
    瀏覽(20)
  • JavaScript 腳本延遲加載方式

    1. defer屬性 用來通知瀏覽器該腳本將在文檔完成解析后,觸發(fā)?DOMContentLoaded?事件前執(zhí)行。 有? defer ?屬性的腳本會阻止? DOMContentLoaded ?事件,直到腳本被加載并且解析完成。 defer 屬性必須配合 src 屬性使用 defer 屬性對于模塊腳本沒有作用 2. async 屬性 對于普通腳本,如果存

    2024年02月05日
    瀏覽(20)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包