<html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> <title>Custom Basemap | Sample | ArcGIS API for JavaScript 4.25</title> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } </style> <link href="https://js.arcgis.com/4.25/esri/themes/light/main.css" rel="stylesheet" type="text/css" /> <script src="https://js.arcgis.com/4.25/"></script> <script> const url = 'http://2.34.105.23/GeoCMS/v1/cf/rest/services/MapService/ESRI/ce351d36-3390-4137-9a21-a8e832a8d7ad' const token = encodeURIComponent("lqU4186710TjW+4WuOh9pgLp837avPI1psVUTLlZA6LYq7ziMYLOVlDg97qYQi5GuI5WhVqE2f/EWdpfQk6CbcyNmSSj9qLklD5A0NxD1/DqLd4eWoGztA==") require([ "esri/Map", "esri/views/MapView", "esri/layers/support/TileInfo", "esri/layers/WebTileLayer", "esri/geometry/SpatialReference", "esri/Basemap", ], ( Map, MapView, TileInfo, WebTileLayer, SpatialReference, Basemap ) => { // Create a WebTileLayer with a third-party cached service let tileInfo = new TileInfo({ rows: 256, cols: 256, dpi: 96, // format: 'png24', format: "MIXED", compressionQuality: 75.0, origin: { x: -180, y: 90, }, spatialReference: { wkid: 4490, }, lods: [ { level: 0, resolution: 0.7031250000000002, scale: 2.9549759305875003E8 }, { level: 1, resolution: 0.3515625000000001, scale: 1.4774879652937502E8 }, { level: 2, resolution: 0.17578125000000006, scale: 7.387439826468751E7 }, { level: 3, resolution: 0.08789062500000003, scale: 3.6937199132343754E7 }, { level: 4, resolution: 0.043945312500000014, scale: 1.8468599566171877E7 }, { level: 5, resolution: 0.021972656250000007, scale: 9234299.783085939 }, { level: 6, resolution: 0.010986328125000003, scale: 4617149.891542969 }, { level: 7, resolution: 0.005493164062500002, scale: 2308574.9457714846 }, { level: 8, resolution: 0.002746582031250001, scale: 1154287.4728857423 }, { level: 9, resolution: 0.0013732910156250004, scale: 577143.7364428712 }, { level: 10, resolution: 6.866455078125002E-4, scale: 288571.8682214356 }, { level: 11, resolution: 3.433227539062501E-4, scale: 144285.9341107178 }, { level: 12, resolution: 1.7166137695312505E-4, scale: 72142.9670553589 }, { level: 13, resolution: 8.583068847656253E-5, scale: 36071.48352767945 }, { level: 14, resolution: 4.2915344238281264E-5, scale: 18035.741763839724 }, { level: 15, resolution: 2.1457672119140632E-5, scale: 9017.870881919862 }, { level: 16, resolution: 1.0728836059570316E-5, scale: 4508.935440959931 }, { level: 17, resolution: 5.364418029785158E-6, scale: 2254.4677204799655 }, { level: 18, resolution: 2.682209014892579E-6, scale: 1127.2338602399827 }, { level: 19, resolution: 1.3411045074462895E-6, scale: 563.6169301199914 }, { level: 20, resolution: 5.9486525145757E-7, scale: 250 }, ], }); let digitalLayer = new WebTileLayer({ id: "ids", title: "custom", urlTemplate: `${url}/tile/{z}/{y}/{x}?token=${token}`, tileInfo: tileInfo, spatialReference: new SpatialReference({ wkid: 4490 }), }); let basemap = new Basemap({ baseLayers: [digitalLayer], }); const map = new Map({ basemap }); const view = new MapView({ container: "viewDiv", map: map, center: [120.83394, 31.64402], zoom: 10, }); }); </script> </head> <body> <div id="viewDiv"></div> </body> </html>
正文
arcgis api加载第三地方地图携带token
文章版权声明:除非注明,否则均为
譬如朝露_策温技术开发工作室博客原创文章,转载或复制请以超链接形式并注明出处。
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接