日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

arcgis api for javascipt 加载天地图、百度地图

發布時間:2025/3/21 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 arcgis api for javascipt 加载天地图、百度地图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

寫在前面的話:

1.百度地圖是自己定義的坐標系統,wkid=102100.百度地圖數據是加密的產物。下文將附上百度坐標與WGS84,谷歌等坐標系統轉換方法(地理-地理),此方法并未親測,據說準

2.百度地圖可以直接加載經緯度坐標

3.百度地圖如果加載的arcgis api中會出現坐標偏移,1.中已經解決了地理坐標轉換,那么找到百度投影-地理坐標的轉換方式,則arcgis就可以直接無偏加載了,網上很多方法,但是親測不行。

4.天地圖不是涉密數據,根據本文提供的類庫,arcgis api for js可以直接加載。但是數據有略微的偏移

?

?

天地圖的切片地圖可以通過esri.layers.TiledMapServiceLayer來加載,在此將之進行了一定的封裝,如下:

1、切片線劃圖——TDTLayer.js

?

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 define(["dojo/_base/declare", ????"esri/layers/tiled"], ????function (declare) { ????????return declare(esri.layers.TiledMapServiceLayer, { ????????????constructor: function () { ????????????????this.spatialReference = new esri.SpatialReference({ wkid: 4326 }); ????????????????this.initialExtent = (this.fullExtent = new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference)); ????????????????this.tileInfo = new esri.layers.TileInfo({ ????????????????????"rows": 256, ????????????????????"cols": 256, ????????????????????"compressionQuality": 0, ????????????????????"origin": { ????????????????????????"x": -180, ????????????????????????"y": 90 ????????????????????}, ????????????????????"spatialReference": { ????????????????????????"wkid": 4326 ????????????????????}, ????????????????????"lods": [ ????????????????????????{ "level": 2, "resolution": 0.3515625, "scale": 147748796.52937502 }, ????????????????????????{ "level": 3, "resolution": 0.17578125, "scale": 73874398.264687508 }, ????????????????????????{ "level": 4, "resolution": 0.087890625, "scale": 36937199.132343754 }, ????????????????????????{ "level": 5, "resolution": 0.0439453125, "scale": 18468599.566171877 }, ????????????????????????{ "level": 6, "resolution": 0.02197265625, "scale": 9234299.7830859385 }, ????????????????????????{ "level": 7, "resolution": 0.010986328125, "scale": 4617149.8915429693 }, ????????????????????????{ "level": 8, "resolution": 0.0054931640625, "scale": 2308574.9457714846 }, ????????????????????????{ "level": 9, "resolution": 0.00274658203125, "scale": 1154287.4728857423 }, ????????????????????????{ "level": 10, "resolution": 0.001373291015625, "scale": 577143.73644287116 }, ????????????????????????{ "level": 11, "resolution": 0.0006866455078125, "scale": 288571.86822143558 }, ????????????????????????{ "level": 12, "resolution": 0.00034332275390625, "scale": 144285.93411071779 }, ????????????????????????{ "level": 13, "resolution": 0.000171661376953125, "scale": 72142.967055358895 }, ????????????????????????{ "level": 14, "resolution": 8.58306884765625e-005, "scale": 36071.483527679447 }, ????????????????????????{ "level": 15, "resolution": 4.291534423828125e-005, "scale": 18035.741763839724 }, ????????????????????????{ "level": 16, "resolution": 2.1457672119140625e-005, "scale": 9017.8708819198619 }, ????????????????????????{ "level": 17, "resolution": 1.0728836059570313e-005, "scale": 4508.9354409599309 }, ????????????????????????{ "level": 18, "resolution": 5.3644180297851563e-006, "scale": 2254.4677204799655 } ????????????????????] ????????????????}); ????????????????this.loaded = true; ????????????????this.onLoad(this); ????????????}, ????????????getTileUrl: function (level, row, col) { ????????????????return "http://t" + col % 8 + ".tianditu.cn/vec_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX=" + level + "&TILEROW=" + row + "&TILECOL=" + col + "&FORMAT=tiles"; ????????????} ????????}); ????});


2、切片標注——TDTAnnoLayer.js

?

?

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 define(["dojo/_base/declare", ????"esri/layers/tiled"], ????function (declare) { ????????return declare(esri.layers.TiledMapServiceLayer, { ????????????constructor: function () { ????????????????this.spatialReference = new esri.SpatialReference({ wkid: 4326 }); ????????????????this.initialExtent = (this.fullExtent = new esri.geometry.Extent(-180.0, -90.0, 180.0, 90.0, this.spatialReference)); ????????????????this.tileInfo = new esri.layers.TileInfo({ ????????????????????"rows": 256, ????????????????????"cols": 256, ????????????????????"compressionQuality": 0, ????????????????????"origin": { ????????????????????????"x": -180, ????????????????????????"y": 90 ????????????????????}, ????????????????????"spatialReference": { ????????????????????????"wkid": 4326 ????????????????????}, ????????????????????"lods": [ ????????????????????????{ "level": 2, "resolution": 0.3515625, "scale": 147748796.52937502 }, ????????????????????????{ "level": 3, "resolution": 0.17578125, "scale": 73874398.264687508 }, ????????????????????????{ "level": 4, "resolution": 0.087890625, "scale": 36937199.132343754 }, ????????????????????????{ "level": 5, "resolution": 0.0439453125, "scale": 18468599.566171877 }, ????????????????????????{ "level": 6, "resolution": 0.02197265625, "scale": 9234299.7830859385 }, ????????????????????????{ "level": 7, "resolution": 0.010986328125, "scale": 4617149.8915429693 }, ????????????????????????{ "level": 8, "resolution": 0.0054931640625, "scale": 2308574.9457714846 }, ????????????????????????{ "level": 9, "resolution": 0.00274658203125, "scale": 1154287.4728857423 }, ????????????????????????{ "level": 10, "resolution": 0.001373291015625, "scale": 577143.73644287116 }, ????????????????????????{ "level": 11, "resolution": 0.0006866455078125, "scale": 288571.86822143558 }, ????????????????????????{ "level": 12, "resolution": 0.00034332275390625, "scale": 144285.93411071779 }, ????????????????????????{ "level": 13, "resolution": 0.000171661376953125, "scale": 72142.967055358895 }, ????????????????????????{ "level": 14, "resolution": 8.58306884765625e-005, "scale": 36071.483527679447 }, ????????????????????????{ "level": 15, "resolution": 4.291534423828125e-005, "scale": 18035.741763839724 }, ????????????????????????{ "level": 16, "resolution": 2.1457672119140625e-005, "scale": 9017.8708819198619 }, ????????????????????????{ "level": 17, "resolution": 1.0728836059570313e-005, "scale": 4508.9354409599309 }, ????????????????????????{ "level": 18, "resolution": 5.3644180297851563e-006, "scale": 2254.4677204799655 } ????????????????????] ????????????????}); ????????????????this.loaded = true; ????????????????this.onLoad(this); ????????????}, ????????????getTileUrl: function (level, row, col) { ????????????????return "http://t" + row % 8 + ".tianditu.cn/cva_c/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=c&TILEMATRIX=" + level + "&TILEROW=" + row + "&TILECOL=" + col + "&FORMAT=tiles"; ????????????} ????????}); ????});


封裝好之后就可以在頁面調用了,調用的時候需要導入這些自定義的圖層,導入方式為:

?

?

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <script type="text/javascript"> ????dojoConfig = { ????????parseOnLoad: true, ????????packages: [{ ????????????name: 'tdlib', ????????????location: this.location.pathname.replace(/\/[^/]+$/, "")+"/js/tdlib" ????????}] ????}; </script> <script src="http://localhost/arcgis_js_api/library/3.9/3.9/init.js"></script> <script> ????require(["tdlib/TDTLayer", ????????"tdlib/TDTAnnoLayer"], ????function (TDTLayer, ?????????TDTAnnoLayer ????){ ????????var basemap = new TDTLayer(); ????????map.addLayer(basemap); ????????var annolayer = new TDTAnnoLayer(); ????????map.addLayer(annolayer); ????}); </script><br><br><span style="color: rgb(128, 0, 0);">完整調用代碼:<br></span>
?
1 <strong>[javascript]</strong> <a title="view plain" class="ViewSource" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">view plain</a><span data-mod="popu_168"> <a title="copy" class="CopyToClipboard" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">copy</a><span data-mod="popu_169"> <a title="print" class="PrintSource" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">print</a><a title="?" class="About" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">?</a><span class="tracking-ad" data-mod="popu_167"><a title="在CODE上查看代碼片" style="text-indent: 0px;" href="https://code.csdn.net/snippets/635113" target="_blank"><img width="12" height="12" style="left: 2px; top: 1px; position: relative;" alt="在CODE上查看代碼片" src="https://code.csdn.net/assets/CODE_ico.png"></a><span class="tracking-ad" data-mod="popu_170"><a title="派生到我的代碼片" style="text-indent: 0px;" href="https://code.csdn.net/snippets/635113/fork" target="_blank"><img width="12" height="12" style="left: 2px; top: 2px; position: relative;" alt="派生到我的代碼片" src="https://code.csdn.net/assets/ico_fork.svg"></a></span></span></span></span>
?
1 <span style="color: rgb(128, 0, 0);"><br><br><br><!DOCTYPE html><br><html><br><head><br>??? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br>??? <title>Baidu Map</title><br>?? <link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css"><br>??? <style><br>??????? html, body, #map {<br>??????????? height: 100%;<br>??????????? margin: 0;<br>??????????? padding: 0;<br>??????? }<br>??????? .base-map-ano{<br>??????????? position: absolute;<br>??????????? right: 0pt;<br>??????????? top:18pt;<br>??????????? background: #e6edf1;<br>??????????? border: #96aed1 1px solid;<br>??????????? padding: 4px 5px;<br>??????????? padding-left: 0px;<br>??????????? padding-top: 0px;<br>??????????? display: none;<br>??????????? font-weight: normal;<br>??????? }<br>??????? .base-map{<br>??????????? position: absolute;<br>??????????? right: 15pt;<br>??????????? top:15pt;<br>??????????? background: #f0f0f0;<br>??????????? border: #96aed1 1px solid;<br>??????????? width: auto;<br>??????????? height: auto;<br>??????????? z-index: 99;<br>??????????? font:normal 11px "宋體",Arial;<br>??????????? color:#868686;<br>??????? }<br>??????? .base-map-switch{<br>??????????? padding: 4px 8px;<br>??????????? float: left;<br>??????? }<br>??????? .base-map-switch-active{<br>??????????? background:#e6edf1;<br>??????????? font-weight: bold;<br>??????????? color: #4d4d4d;<br>??????? }<br>??????? .base-map-switch:hover{<br>??????????? cursor: pointer;<br>??????? }<br>??????? .base-map-switch-center{<br>??????????? border: 1px #96aed1 solid;<br>??????????? border-top:none;<br>??????????? border-bottom:none;<br>??????? }<br>??? </style><br>??? <script type="text/javascript"><br>??????? dojoConfig = {<br>??????????? parseOnLoad: true,<br>??????????? packages: [{<br>??????????????? name: 'bdlib',<br>??????????????? location: this.location.pathname.replace(/\/[^/]+$/, "")+"/js/bdlib"<br>??????????? }]<br>??????? };<br>??? </script><br>??? <script type="text/javascript" src="js/transformspatial.js"></script><br>?? ?<script src="https://js.arcgis.com/3.17/"></script><br>?? ?<script type="text/javascript" src="js/plugins/jquery-1.11.1.min.js"></script><br>??? <script><br>?????? var test=GPS.mercator_encrypt(39.115698,117.264604);<br>?????? console.log(test);<br>??????? var map,showMap,anoCtrl;<br>??????? require(["esri/map",<br>??????????? "bdlib/BDVecLayer",<br>??????????? "bdlib/BDImgLayer",<br>??????????? "bdlib/BDAnoLayer",<br>??????????? "esri/layers/FeatureLayer",<br>??????????? "esri/geometry/Point",<br>??????????? "esri/SpatialReference",<br>??????????? "dojo/domReady!"],<br>??????????????? function (Map,<br>????????????????????????? BDVecLayer,<br>????????????????????????? BDImgLayer,<br>????????????????????????? BDAnoLayer,<br>????????????????????????? FeatureLayer,<br>????????????????????????? Point,<br>????????????????????????? SpatialReference<br>??????????????????????? ){<br>??????????????????? map = new Map("map", {<br>??????????????????????? logo: false<br>??????????????????? });<br>??????????????????? var vecMap = new BDVecLayer();<br>??????????????????? var imgMap = new BDImgLayer();<br>??????????????????? var anoMap = new BDAnoLayer();<br>??????????????????? map.addLayer(vecMap);<br>??????????????????? map.addLayers([imgMap,anoMap]);<br>??????????????????? imgMap.hide(),anoMap.hide();<br>map.on("mouse-down",function(item){<br>?? ??? ??? ??? ??? ??? ?mousedownlocation=item;<br>?? ??? ??? ??? ??? ??? ?console.log(item.mapPoint.x+"||"+item.mapPoint.y);<br>?? ??? ??? ??? ??? ??? ?//console.log(mousedownlocation.pageX+"down||down"+mousedownlocation.pageY);<br>?? ??? ??? ??? ??? ?})<br>??????????????????? var pt = new Point(7795368.13681627, 2813270.0795953586, new SpatialReference({ wkid: 102100 }));<br>??????????????????? map.centerAndZoom(pt, 19);<br>??????????????????? map.on("mouse-move",function(evt){<br>????????????????????? // console.log(evt);<br>??????????????????? })<br>??????????????????? showMap = function(layer){<br>??????????????????????? //設置按鈕樣式<br>??????????????????????? var baseMap = ["vec","img"];<br>??????????????????????? for(var i= 0, dl=baseMap.length;i<dl;i++){<br>??????????????????????????? $("#"+baseMap[i]).removeClass("base-map-switch-active");<br>??????????????????????? }<br>??????????????????????? $("#"+layer).addClass("base-map-switch-active");<br>??????????????????????? //設置顯示地圖<br>??????????????????????? switch(layer){<br>??????????????????????????? case "img":{//影像<br>??????????????????????????????? vecMap.hide();<br>??????????????????????????????? imgMap.show();<br>??????????????????????????????? $("#ano").show();<br>??????????????????????????????? break;<br>??????????????????????????? }<br>??????????????????????????? default :{//地圖<br>??????????????????????????????? vecMap.show();<br>??????????????????????????????? imgMap.hide(),anoMap.hide();<br>??????????????????????????????? $("#ano").hide();<br>??????????????????????????????? $("#chkAno").attr("checked",false);<br>??????????????????????????????? break;<br>??????????????????????????? }<br>??????????????????????? }<br>??????????????????? };<br>??????????????????? anoCtrl = function(){<br>??????????????????????? if($("#chkAno").is(":checked")){<br>??????????????????????????? anoMap.show();<br>??????????????????????? }<br>??????????????????????? else{<br>??????????????????????????? anoMap.hide();<br>??????????????????????? }<br>??????????????????? }<br>??????????????? });<br>??? </script><br></head><br><body><br><div id="map"><br>??? <div class="base-map"><br>??????? <div id="vec" class="base-map-switch base-map-switch-active" onclick="showMap('vec')">地圖</div><br>??????? <div id="img" class="base-map-switch base-map-switch-center"? onclick="showMap('img')">影像<br>??????????? <div id="ano" class="base-map-ano"><br>??????????????? <input id="chkAno" type="checkbox" name="chkAno" value="chkAno" onchange="anoCtrl()"/>標注<br>??????????? </div><br>??????? </div><br>??? </div><br></div><br></body><br></html><br><br><br>百度地圖可調用的有地圖切片,影像切片,以及道路等POI切片,我將之用<span style="font-family: Consolas; font-size: 9pt;"><span style="font-family: Consolas; font-size: 9pt;">TiledMapServiceLayer做了擴展,成了BDAnoLayer,BDVecLayer,BDimgLayer三個圖層,其代碼如下:</span></span></span>

BDAnoLayer.js

?

[javascript] view plaincopy print?
  • define(["dojo/_base/declare",??
  • ????"esri/layers/tiled"],??
  • ????function?(declare)?{??
  • ????????return?declare(esri.layers.TiledMapServiceLayer,?{??
  • ????????????constructor:?function?()?{??
  • ????????????????this.spatialReference?=?new?esri.SpatialReference({?wkid:?102100?});??
  • ????????????????this.initialExtent?=?(this.fullExtent?=?new?esri.geometry.Extent(-20037508.3427892,?-20037508.3427892,?20037508.3427892,?20037508.3427892,?this.spatialReference));??
  • ????????????????this.scale?=?[591657527.591555,295828763.795777,147914381.897889,73957190.948944,36978595.474472,18489297.737236,9244648.868618,??
  • ????????????????????4622324.434309,2311162.217155,1155581.108577,577790.554289,288895.277144,144447.638572,72223.819286,??
  • ????????????????????36111.9096437,18055.9548224,9027.977411,4513.988705,2256.994353,1128.497176];??
  • ????????????????this.resolution?=?[156543.033928,78271.5169639999,39135.7584820001,19567.8792409999,9783.93962049996,4891.96981024998,2445.98490512499,??
  • ????????????????????1222.99245256249,611.49622628138,305.748113140558,152.874056570411,76.4370282850732,38.2185141425366,19.1092570712683,9.55462853563415,??
  • ????????????????????4.77731426794937,2.38865713397468,1.19432856685505,0.597164283559817,0.298582141647617];??
  • ????????????????this.tileInfo?=?new?esri.layers.TileInfo({??
  • ????????????????????"rows":?256,??
  • ????????????????????"cols":?256,??
  • ????????????????????"compressionQuality":?90,??
  • ????????????????????"origin":?{??
  • ????????????????????????"x":?-20037508.3427892,??
  • ????????????????????????"y":?20037508.3427892??
  • ????????????????????},??
  • ????????????????????"spatialReference":?this.spatialReference,??
  • ????????????????????"lods":?[{?"level":?0,?"resolution":?this.resolution[0],?"scale":?this.scale[0]?},??
  • ????????????????????????{?"level":?1,?"resolution":?this.resolution[1],?"scale":?this.scale[1]?},??
  • ????????????????????????{?"level":?2,?"resolution":?this.resolution[2],?"scale":?this.scale[2]?},??
  • ????????????????????????{?"level":?3,?"resolution":?this.resolution[3],?"scale":?this.scale[3]?},??
  • ????????????????????????{?"level":?4,?"resolution":?this.resolution[4],?"scale":?this.scale[4]?},??
  • ????????????????????????{?"level":?5,?"resolution":?this.resolution[5],?"scale":?this.scale[5]?},??
  • ????????????????????????{?"level":?6,?"resolution":?this.resolution[6],?"scale":?this.scale[6]?},??
  • ????????????????????????{?"level":?7,?"resolution":?this.resolution[7],?"scale":?this.scale[7]?},??
  • ????????????????????????{?"level":?8,?"resolution":?this.resolution[8],?"scale":?this.scale[8]?},??
  • ????????????????????????{?"level":?9,?"resolution":?this.resolution[9],?"scale":?this.scale[9]?},??
  • ????????????????????????{?"level":?10,?"resolution":?this.resolution[10],?"scale":?this.scale[10]?},??
  • ????????????????????????{?"level":?11,?"resolution":?this.resolution[11],?"scale":?this.scale[11]?},??
  • ????????????????????????{?"level":?12,?"resolution":?this.resolution[12],?"scale":?this.scale[12]?},??
  • ????????????????????????{?"level":?13,?"resolution":?this.resolution[13],?"scale":?this.scale[13]?},??
  • ????????????????????????{?"level":?14,?"resolution":?this.resolution[14],?"scale":?this.scale[14]?},??
  • ????????????????????????{?"level":?15,?"resolution":?this.resolution[15],?"scale":?this.scale[15]?},??
  • ????????????????????????{?"level":?16,?"resolution":?this.resolution[16],?"scale":?this.scale[16]?},??
  • ????????????????????????{?"level":?17,?"resolution":?this.resolution[17],?"scale":?this.scale[17]?},??
  • ????????????????????????{?"level":?18,?"resolution":?this.resolution[18],?"scale":?this.scale[18]?},??
  • ????????????????????????{?"level":?19,?"resolution":?this.resolution[19],?"scale":?this.scale[19]?}??
  • ????????????????????]??
  • ????????????????});??
  • ????????????????this.loaded?=?true;??
  • ????????????????this.onLoad(this);??
  • ????????????},??
  • ????????????getTileUrl:?function?(level,?row,?col)?{??
  • ????????????????var?zoom?=?level?-?1;??
  • ????????????????var?offsetX?=?parseInt(Math.pow(2,?zoom));??
  • ????????????????var?offsetY?=?offsetX?-?1;??
  • ????????????????var?numX?=?col?-?offsetX,?numY?=?(-row)?+?offsetY?;??
  • ????????????????var?num?=?(col?+?row)?%?8?+?1;??
  • ????????????????return?"http://online"?+?num?+?".map.bdimg.com/tile/?qt=tile&x="+numX+"&y="+numY+"&z="+level+"&styles=sl&udt=20141015";??
  • ????????????}??
  • ????????});??
  • ????});??
  • BDVecLayer.js

    ?

    [javascript] view plaincopy print?
  • define(["dojo/_base/declare",??
  • ????"esri/layers/tiled"],??
  • ????function?(declare)?{??
  • ????????return?declare(esri.layers.TiledMapServiceLayer,?{??
  • ????????????constructor:?function?()?{??
  • ????????????????this.spatialReference?=?new?esri.SpatialReference({?wkid:?102100?});??
  • ????????????????this.initialExtent?=?(this.fullExtent?=?new?esri.geometry.Extent(-20037508.3427892,?-20037508.3427892,?20037508.3427892,?20037508.3427892,?this.spatialReference));??
  • ????????????????this.scale?=?[591657527.591555,295828763.795777,147914381.897889,73957190.948944,36978595.474472,18489297.737236,9244648.868618,??
  • ????????????????????4622324.434309,2311162.217155,1155581.108577,577790.554289,288895.277144,144447.638572,72223.819286,??
  • ????????????????????36111.9096437,18055.9548224,9027.977411,4513.988705,2256.994353,1128.497176];??
  • ????????????????this.resolution?=?[156543.033928,78271.5169639999,39135.7584820001,19567.8792409999,9783.93962049996,4891.96981024998,2445.98490512499,??
  • ????????????????????1222.99245256249,611.49622628138,305.748113140558,152.874056570411,76.4370282850732,38.2185141425366,19.1092570712683,9.55462853563415,??
  • ????????????????????4.77731426794937,2.38865713397468,1.19432856685505,0.597164283559817,0.298582141647617];??
  • ????????????????this.tileInfo?=?new?esri.layers.TileInfo({??
  • ????????????????????"rows":?256,??
  • ????????????????????"cols":?256,??
  • ????????????????????"compressionQuality":?90,??
  • ????????????????????"origin":?{??
  • ????????????????????????"x":?-20037508.3427892,??
  • ????????????????????????"y":?20037508.3427892??
  • ????????????????????},??
  • ????????????????????"spatialReference":?this.spatialReference,??
  • ????????????????????"lods":?[{?"level":?0,?"resolution":?this.resolution[0],?"scale":?this.scale[0]?},??
  • ????????????????????????{?"level":?1,?"resolution":?this.resolution[1],?"scale":?this.scale[1]?},??
  • ????????????????????????{?"level":?2,?"resolution":?this.resolution[2],?"scale":?this.scale[2]?},??
  • ????????????????????????{?"level":?3,?"resolution":?this.resolution[3],?"scale":?this.scale[3]?},??
  • ????????????????????????{?"level":?4,?"resolution":?this.resolution[4],?"scale":?this.scale[4]?},??
  • ????????????????????????{?"level":?5,?"resolution":?this.resolution[5],?"scale":?this.scale[5]?},??
  • ????????????????????????{?"level":?6,?"resolution":?this.resolution[6],?"scale":?this.scale[6]?},??
  • ????????????????????????{?"level":?7,?"resolution":?this.resolution[7],?"scale":?this.scale[7]?},??
  • ????????????????????????{?"level":?8,?"resolution":?this.resolution[8],?"scale":?this.scale[8]?},??
  • ????????????????????????{?"level":?9,?"resolution":?this.resolution[9],?"scale":?this.scale[9]?},??
  • ????????????????????????{?"level":?10,?"resolution":?this.resolution[10],?"scale":?this.scale[10]?},??
  • ????????????????????????{?"level":?11,?"resolution":?this.resolution[11],?"scale":?this.scale[11]?},??
  • ????????????????????????{?"level":?12,?"resolution":?this.resolution[12],?"scale":?this.scale[12]?},??
  • ????????????????????????{?"level":?13,?"resolution":?this.resolution[13],?"scale":?this.scale[13]?},??
  • ????????????????????????{?"level":?14,?"resolution":?this.resolution[14],?"scale":?this.scale[14]?},??
  • ????????????????????????{?"level":?15,?"resolution":?this.resolution[15],?"scale":?this.scale[15]?},??
  • ????????????????????????{?"level":?16,?"resolution":?this.resolution[16],?"scale":?this.scale[16]?},??
  • ????????????????????????{?"level":?17,?"resolution":?this.resolution[17],?"scale":?this.scale[17]?},??
  • ????????????????????????{?"level":?18,?"resolution":?this.resolution[18],?"scale":?this.scale[18]?},??
  • ????????????????????????{?"level":?19,?"resolution":?this.resolution[19],?"scale":?this.scale[19]?}??
  • ????????????????????]??
  • ????????????????});??
  • ????????????????this.loaded?=?true;??
  • ????????????????this.onLoad(this);??
  • ????????????},??
  • ????????????getTileUrl:?function?(level,?row,?col)?{??
  • ????????????????var?zoom?=?level?-?1;??
  • ????????????????var?offsetX?=?parseInt(Math.pow(2,?zoom));??
  • ????????????????var?offsetY?=?offsetX?-?1;??
  • ????????????????var?numX?=?col?-?offsetX,?numY?=?(-row)?+?offsetY?;??
  • ????????????????var?num?=?(col?+?row)?%?8?+?1;??
  • ????????????????return?"http://online"?+?num?+?".map.bdimg.com/tile/?qt=tile&x="+numX+"&y="+numY+"&z="+level+"&styles=pl&scaler=1&udt=20141103";??
  • ????????????}??
  • ????????});??
  • ????});??
  • BDimgLayer.js

    [javascript] view plain copy print?
  • define(["dojo/_base/declare",??
  • ????"esri/layers/tiled"],??
  • ????function?(declare)?{??
  • ????????return?declare(esri.layers.TiledMapServiceLayer,?{??
  • ????????????constructor:?function?()?{??
  • ????????????????this.spatialReference?=?new?esri.SpatialReference({?wkid:?102100?});??
  • ????????????????this.initialExtent?=?(this.fullExtent?=?new?esri.geometry.Extent(-20037508.3427892,?-20037508.3427892,?20037508.3427892,?20037508.3427892,?this.spatialReference));??
  • ????????????????this.scale?=?[591657527.591555,295828763.795777,147914381.897889,73957190.948944,36978595.474472,18489297.737236,9244648.868618,??
  • ????????????????????4622324.434309,2311162.217155,1155581.108577,577790.554289,288895.277144,144447.638572,72223.819286,??
  • ????????????????????36111.9096437,18055.9548224,9027.977411,4513.988705,2256.994353,1128.497176];??
  • ????????????????this.resolution?=?[156543.033928,78271.5169639999,39135.7584820001,19567.8792409999,9783.93962049996,4891.96981024998,2445.98490512499,??
  • ????????????????????1222.99245256249,611.49622628138,305.748113140558,152.874056570411,76.4370282850732,38.2185141425366,19.1092570712683,9.55462853563415,??
  • ????????????????????4.77731426794937,2.38865713397468,1.19432856685505,0.597164283559817,0.298582141647617];??
  • ????????????????this.tileInfo?=?new?esri.layers.TileInfo({??
  • ????????????????????"rows":?256,??
  • ????????????????????"cols":?256,??
  • ????????????????????"compressionQuality":?90,??
  • ????????????????????"origin":?{??
  • ????????????????????????"x":?-20037508.3427892,??
  • ????????????????????????"y":?20037508.3427892??
  • ????????????????????},??
  • ????????????????????"spatialReference":?this.spatialReference,??
  • ????????????????????"lods":?[{?"level":?0,?"resolution":?this.resolution[0],?"scale":?this.scale[0]?},??
  • ????????????????????????{?"level":?1,?"resolution":?this.resolution[1],?"scale":?this.scale[1]?},??
  • ????????????????????????{?"level":?2,?"resolution":?this.resolution[2],?"scale":?this.scale[2]?},??
  • ????????????????????????{?"level":?3,?"resolution":?this.resolution[3],?"scale":?this.scale[3]?},??
  • ????????????????????????{?"level":?4,?"resolution":?this.resolution[4],?"scale":?this.scale[4]?},??
  • ????????????????????????{?"level":?5,?"resolution":?this.resolution[5],?"scale":?this.scale[5]?},??
  • ????????????????????????{?"level":?6,?"resolution":?this.resolution[6],?"scale":?this.scale[6]?},??
  • ????????????????????????{?"level":?7,?"resolution":?this.resolution[7],?"scale":?this.scale[7]?},??
  • ????????????????????????{?"level":?8,?"resolution":?this.resolution[8],?"scale":?this.scale[8]?},??
  • ????????????????????????{?"level":?9,?"resolution":?this.resolution[9],?"scale":?this.scale[9]?},??
  • ????????????????????????{?"level":?10,?"resolution":?this.resolution[10],?"scale":?this.scale[10]?},??
  • ????????????????????????{?"level":?11,?"resolution":?this.resolution[11],?"scale":?this.scale[11]?},??
  • ????????????????????????{?"level":?12,?"resolution":?this.resolution[12],?"scale":?this.scale[12]?},??
  • ????????????????????????{?"level":?13,?"resolution":?this.resolution[13],?"scale":?this.scale[13]?},??
  • ????????????????????????{?"level":?14,?"resolution":?this.resolution[14],?"scale":?this.scale[14]?},??
  • ????????????????????????{?"level":?15,?"resolution":?this.resolution[15],?"scale":?this.scale[15]?},??
  • ????????????????????????{?"level":?16,?"resolution":?this.resolution[16],?"scale":?this.scale[16]?},??
  • ????????????????????????{?"level":?17,?"resolution":?this.resolution[17],?"scale":?this.scale[17]?},??
  • ????????????????????????{?"level":?18,?"resolution":?this.resolution[18],?"scale":?this.scale[18]?},??
  • ????????????????????????{?"level":?19,?"resolution":?this.resolution[19],?"scale":?this.scale[19]?}??
  • ????????????????????]??
  • ????????????????});??
  • ????????????????this.loaded?=?true;??
  • ????????????????this.onLoad(this);??
  • ????????????},??
  • ????????????getTileUrl:?function?(level,?row,?col)?{??
  • ????????????????var?zoom?=?level?-?1;??
  • ????????????????var?offsetX?=?parseInt(Math.pow(2,?zoom));??
  • ????????????????var?offsetY?=?offsetX?-?1;??
  • ????????????????var?numX?=?col?-?offsetX,?numY?=?(-row)?+?offsetY?;??
  • ????????????????var?num?=?(col?+?row)?%?8?+?1;??
  • ????????????????return?"http://shangetu"?+?num?+?".map.bdimg.com/it/u=x="+numX+";y="+numY+";z="+level+";v=009;type=sate&fm=46&udt=20141015";??
  • ????????????}??
  • ????????});??
  • ????});??
  • ?
    1 2 <span style="color: rgb(128, 0, 0);"> <span style="font-family: Consolas; font-size: 9pt;"><span style="font-family: Consolas; font-size: 9pt;"><span style="font-family: Consolas;"><span class="tracking-ad" data-mod="popu_170"><strong>[javascript]</strong> <a title="view plain" class="ViewSource" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">view plain</a><span data-mod="popu_168"> <a title="copy" class="CopyToClipboard" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">copy</a><span data-mod="popu_169"> <a title="print" class="PrintSource" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">print</a><a title="?" class="About" href="http://blog.csdn.net/gisshixisheng/article/details/44853709#">?</a><span class="tracking-ad" data-mod="popu_167"><a title="在CODE上查看代碼片" style="text-indent: 0px;" href="https://code.csdn.net/snippets/635113" target="_blank"><img width="12" height="12" style="left: 2px; top: 1px; position: relative;" alt="在CODE上查看代碼片" src="https://code.csdn.net/assets/CODE_ico.png"></a><span class="tracking-ad" data-mod="popu_170"><a title="派生到我的代碼片" style="text-indent: 0px;" href="https://code.csdn.net/snippets/635113/fork" target="_blank"><img width="12" height="12" style="left: 2px; top: 2px; position: relative;" alt="派生到我的代碼片" src="https://code.csdn.net/assets/ico_fork.svg"></a></span></span></span></span></span></span></span></span></span>
  • <!DOCTYPE?html>??
  • <html>??
  • <head>??
  • ????<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>??
  • ????<meta?name="viewport"?content="initial-scale=1.0,?user-scalable=no"?/>??
  • ????<style?type="text/css">??
  • ????????body,?html,#allmap?{width:?100%;height:?100%;overflow:?hidden;margin:0;font-family:"微軟雅黑";}??
  • ????</style>??
  • ????<script?type="text/javascript"?src="http://api.map.baidu.com/api?v=2.0&ak=你的秘鑰"></script>??
  • ????<title>地圖展示</title>??
  • </head>??
  • <body>??
  • <div?id="allmap"></div>??
  • </body>??
  • </html>??
  • <script?type="text/javascript">??
  • ????//?百度地圖API功能??
  • ????var?map?=?new?BMap.Map("allmap");????//?創建Map實例??
  • ????map.centerAndZoom(new?BMap.Point(116.404,?39.915),?5);??//?初始化地圖,設置中心點坐標和地圖級別??
  • ????map.addControl(new?BMap.MapTypeControl());???//添加地圖類型控件??
  • ????map.setCurrentCity("北京");??????????//?設置地圖顯示的城市?此項是必須設置的??
  • ????map.enableScrollWheelZoom(true);?????//開啟鼠標滾輪縮放??
  • </script>?
  • ?
    1 <span style="color: rgb(128, 0, 0);">?</span>

    總結

    以上是生活随笔為你收集整理的arcgis api for javascipt 加载天地图、百度地图的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 精品成人av一区二区在线播放 | 99久久婷婷国产综合精品 | 色婷婷av久久久久久久 | 亚洲成人av | 人妻精品一区二区三区 | 天天躁狠狠躁狠狠躁夜夜躁68 | 成人免费做受小说 | 免费观看av毛片 | 日韩人妻精品无码一区二区三区 | jizz免费视频 | 国产免费黄色大片 | 久久精品老司机 | 色女孩综合 | 久久中文免费视频 | 中文视频一区二区 | 特黄老太婆aa毛毛片 | 毛片黄色片 | 丁香啪啪综合成人亚洲 | 美女啪啪无遮挡 | 美女脱得一干二净 | 国产91精品露脸国语对白 | 快色污 | 亚洲成人网在线 | 欧美一区二区三区免费看 | 国产精品婷婷 | 4438x全国最大成人网 | 黄色片免费看 | 蜜臀av夜夜澡人人爽人人 | 三及毛片 | 久久久看 | 日韩精品乱码 | av资源站 | 豆花在线视频 | 国产色吧 | 乌克兰极品av女神 | 国产3级| 欧美变态绿帽cuckold | 丝袜 亚洲 另类 国产 制服 | 天堂视频网| 亚洲欧洲日本在线 | 国产成人三级一区二区在线观看一 | 臭脚猛1s民工调教奴粗口视频 | 亚洲一区在线不卡 | 美女少妇直播 | 欧美99久久精品乱码影视 | 国产精品久久久久久久专区 | 国产精品国产三级国产传播 | 国产一区二区视频在线播放 | 国产免费黄色小视频 | 91狠狠综合| 伊人网综合网 | 精品一区二区在线免费观看 | 亚洲天堂一区二区三区 | 欧洲精品一区二区三区久久 | 国产资源站 | 女性私密整形视频 | 日韩丰满少妇无码内射 | 麻豆毛片 | 成人手机视频 | 91精品国产99久久久久久红楼 | 国产又大又黄又爽 | av白浆| 国产亚洲成人精品 | 国产色自拍| 国产成人av一区 | 久久九九视频 | 国产精品久久久久久久久久东京 | 免费成人在线电影 | 久久99精品视频 | 91色蝌蚪| 国产精品久久久久久久久绿色 | 99r精品视频 | 精品一区二区久久久久久按摩 | 欧美激情一区二区在线 | 综合 欧美 亚洲日本 | 亚洲欧美国产高清 | 国产成人精品无码免费看在线 | 国产精品美女www爽爽爽视频 | 亚洲综合在 | av漫画在线观看 | 激情小说在线 | 国产手机在线观看 | 黄色日批视频 | 电家庭影院午夜 | 日本新japanese乱熟 | 久久久.com | 欧美亚洲在线播放 | 黄色午夜影院 | 中文一区二区在线 | 国产肥白大熟妇bbbb视频 | 日韩中文字幕在线播放 | 欧美天天干 | 欧美日韩免费一区二区 | 国产在线观看黄色 | 色综合啪啪 | 亚洲乱熟女一区二区 | 性三级视频 | 内射一区二区三区 | 男女啪啪无遮挡 |