欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
leaflet入門(mén)——地圖加載(以arcgis服務(wù)為例)

最近由于項目需求,于是開(kāi)始了leaflet的學(xué)習,leaflet在加載地圖上具有自己獨特的優(yōu)勢,能夠在各種瀏覽器(包括手機)下面很好的運行,并且具有很多的插件供我們選擇。在該教程中, 我們使用了除leaflet之外的額外插件有 esri-leaflet.js(https://esri.github.io/esri-leaflet/)、L.Control.MousePosition.js(https://github.com/ardhi/Leaflet.MousePosition)、【proj4.js與proj4leaflet.js】(https://github.com/kartena/Proj4Leaflet)。

1. 動(dòng)態(tài)圖層加載

在加載還圖層的時(shí)候注意,此時(shí)的URL只能是動(dòng)態(tài)圖層服務(wù)地址,不能具體到某個(gè)圖層。加載代碼如下:

  1. let map = L.map('divclass').setView([28.751407,118.628740],12);
  2. let dynamicLayer = L.esri.dynamicMapLayer({
  3. url:'http://localhost:6080/arcgis/rest/services/js/jsdxt/MapServer/',
  4. opacity: 0.8,
  5. f:'json'
  6. });
  7. map.addLayer(dynamicLayer);

2. 要素圖層加載

  1. let map = L.map('divclass').setView([28.751407,118.628740],12);
  2. let featureLayer = L.esri.featureLayer({
  3. url:'http://localhost:6080/arcgis/rest/services/js/tx/MapServer/1/'
  4. });
  5. map.addLayer(featureLayer);

3. 切片圖層的加載

our map service must be published using the Web Mercator Auxiliary Sphere tiling scheme (WKID 102100/3857) and the default scale options used by Google Maps, Bing Maps and .Esri Leaflet will not support any other spatial reference for tile layers.

這個(gè)摘自官方的一段(https://esri.github.io/esri-leaflet/api-reference/layers/tiled-map-layer.html),大概的意思是當我們使用L.esri.tiledMapLayer的時(shí)候,支持WKID為102100/3857的投影地圖,既是我們平常使用的web墨卡托投影的地圖,其余的地圖投影不支持,此時(shí)我們就需要用到proj4.js與proj4leaflet.js這兩個(gè)庫來(lái)進(jìn)行自定義投影,具體的投影轉換已經(jīng)各種參數的定義,我們可以通過(guò)(https://epsg.io/)這個(gè)網(wǎng)站來(lái)獲取,比如我們搜索4490,如下圖,箭頭所指的就是我們使用Proj4來(lái)進(jìn)行投影時(shí)的定義參數:

當我們獲取到了投影參數之后,我們就可以使用L.Proj.CRS來(lái)定義一個(gè)投影了,具體代碼如下:

  1. let tileMapUrl ="http://localhost:6082/arcgis/rest/services/jhzhps/JHJT/MapServer";
  2. let CRS_4490 = new L.Proj.CRS("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs", {
  3. resolutions: [
  4. 1.40625,
  5. 0.703125,
  6. 0.3515625,
  7. 0.17578125,
  8. 0.087890625,
  9. 0.0439453125,
  10. 0.02197265625,
  11. 0.010986328125,
  12. 0.0054931640625,
  13. 0.00274658203125,
  14. 0.001373291015625,
  15. 6.866455078125E-4,
  16. 3.4332275390625E-4,
  17. 1.71661376953125E-4,
  18. 8.58306884765625E-5,
  19. 4.291534423828125E-5,
  20. 2.1457672119140625E-5,
  21. 1.0728836059570312E-5,
  22. 5.364418029785156E-6,
  23. 2.682209064925356E-6,
  24. 1.3411045324626732E-6
  25. ],
  26. origin: [-179.9999, 90.00016],
  27. bounds: L.bounds([117.75370429660006, 26.99449191557761, ], [123.63262097540007, 32.2668788575695])
  28. //這里可以有origin、transformation、scales、resulutions、bounds幾個(gè)參數提供
  29. //選擇,其中scales與resolutions不能同時(shí)配置
  30. });
  31. let map = L.map('divclass',{
  32. crs:CRS_4490
  33. }).setView([29.108339,119.647787],13);
  34. let tileMapLayer = L.esri.tiledMapLayer({
  35. url:tileMapUrl
  36. });
  37. //L.esri.basemapLayer('Gray').addTo(map);
  38. map.addLayer(tileMapLayer);
  39. L.control.mousePosition({
  40. 'position': 'bottomright'
  41. }).addTo(map);

此時(shí),我們已經(jīng)完成了對切片,要素,動(dòng)態(tài)地圖的加載,此代碼僅供初學(xué)者學(xué)習借鑒,整個(gè)文件的代碼如下圖所示:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>leaflet實(shí)例</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <!--添加leaflet樣式文件-->
  10. <link rel="stylesheet" type="text/css" href="../floodIndex/leaflet/leaflet.css">
  11. <link rel="stylesheet" type="text/css" href="../floodIndex/css/L.Control.MousePosition.css">
  12. <!--添加leaflet引用-->
  13. <script type="text/javascript" src="../floodIndex/leaflet/leaflet-src.js"></script>
  14. <script type="text/javascript" src="../floodIndex/leaflet/esri-leaflet.js"></script>
  15. <script type="text/javascript" src="../floodIndex/leaflet/L.Control.MousePosition.js"></script>
  16. <script type="text/javascript" src="../floodIndex/leaflet/proj4.js"></script>
  17. <script type="text/javascript" src="../floodIndex/leaflet/proj4leaflet.js"></script>
  18. <style>
  19. html,body{
  20. margin:0;
  21. padding: 0;
  22. }
  23. #divclass{
  24. height:calc(100% - 50px) ;
  25. width: 100%;
  26. background: white;
  27. position: absolute;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div style="width: 100%;height: 50px">
  33. </div>
  34. <div id="divclass">
  35. </div>
  36. <script>
  37. //1. 動(dòng)態(tài)圖層加載 注意此時(shí)的URL只能是動(dòng)態(tài)圖層服務(wù)地址 只能具體到某個(gè)圖層
  38. let map = L.map('divclass').setView([28.751407,118.628740],12);
  39. let dynamicLayer = L.esri.dynamicMapLayer({
  40. url:'http://localhost:6080/arcgis/rest/services/js/jsdxt/MapServer/',
  41. opacity: 0.8,
  42. f:'json'
  43. });
  44. map.addLayer(dynamicLayer);
  45. //2.加載要素圖層
  46. let map = L.map('divclass').setView([28.751407,118.628740],12);
  47. let featureLayer = L.esri.featureLayer({
  48. url:'http://localhost:6080/arcgis/rest/services/js/tx/MapServer/1/'
  49. });
  50. map.addLayer(featureLayer);
  51. //3.加載切片圖層
  52. /**
  53. * Your map service must be published using the Web Mercator Auxiliary Sphere tiling scheme (WKID 102100/3857)
  54. * and the default scale options used by Google Maps, Bing Maps and .
  55. * Esri Leaflet will not support any other spatial reference for tile layers.
  56. */
  57. let tileMapUrl ="http://localhost:6082/arcgis/rest/services/jhzhps/JHJT/MapServer";
  58. let CRS_4490 = new L.Proj.CRS("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs", {
  59. resolutions: [
  60. 1.40625,
  61. 0.703125,
  62. 0.3515625,
  63. 0.17578125,
  64. 0.087890625,
  65. 0.0439453125,
  66. 0.02197265625,
  67. 0.010986328125,
  68. 0.0054931640625,
  69. 0.00274658203125,
  70. 0.001373291015625,
  71. 6.866455078125E-4,
  72. 3.4332275390625E-4,
  73. 1.71661376953125E-4,
  74. 8.58306884765625E-5,
  75. 4.291534423828125E-5,
  76. 2.1457672119140625E-5,
  77. 1.0728836059570312E-5,
  78. 5.364418029785156E-6,
  79. 2.682209064925356E-6,
  80. 1.3411045324626732E-6
  81. ],
  82. origin: [-179.9999, 90.00016],
  83. bounds: L.bounds([117.75370429660006, 26.99449191557761, ], [123.63262097540007, 32.2668788575695])
  84. //這里可以有origin、transformation、scales、resulutions、bounds幾個(gè)參數提供
  85. //選擇,其中scales與resolutions不能同時(shí)配置
  86. });
  87. let map = L.map('divclass',{
  88. crs:CRS_4490
  89. }).setView([29.108339,119.647787],13);
  90. let tileMapLayer = L.esri.tiledMapLayer({
  91. url:tileMapUrl
  92. });
  93. //L.esri.basemapLayer('Gray').addTo(map);
  94. map.addLayer(tileMapLayer);
  95. L.control.mousePosition({
  96. 'position': 'bottomright'
  97. }).addTo(map);
  98. </script>
  99. </body>
  100. </html>

 

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
leaflet-webpack 入門(mén)開(kāi)發(fā)系列二加載不同在線(xiàn)地圖切換顯示(附源碼下載)
入門(mén)Leaflet之小Demo
leaflet加載百度地圖(矯正篇
[ArcGIS API for JavaScript 4.8] Sample Code-Get Started-layers簡(jiǎn)介
leaflet實(shí)現風(fēng)場(chǎng)圖
ArcGIS
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久