ArcGIS API For JavaScript学习笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS API For JavaScript学习笔记相关的知识,希望对你有一定的参考价值。
描述
此示例演示如何创建一个简单的 LayerList 用于切换可见性。在该特定示例中,小部件包含在侧面板内。该窗口小部件使用ArcGIS Online Web地图中的图层。
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Layer List Dijit</title> <link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css"> <style> html, body, .container, #map { height:100%; width:100%; margin:0; padding:0; margin:0; font-family: "Open Sans"; } #map { padding:0; } #layerListPane{ width:25%; } .esriLayer{ background-color: #fff; } .esriLayerList .esriList{ border-top:none; } .esriLayerList .esriTitle { background-color: #fff; border-bottom:none; } .esriLayerList .esriList ul{ background-color: #fff; } </style> <script>var dojoConfig = { parseOnLoad: true };</script> <script src="https://js.arcgis.com/3.20/"></script> <script> require([ "esri/arcgis/utils", "esri/dijit/LayerList", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( arcgisUtils, LayerList ) { //Create a map based on an ArcGIS Online web map id arcgisUtils.createMap("f63fed3f87fc488489e27c026fa5d434", "map").then(function(response){ var myWidget = new LayerList({ map: response.map, layers: arcgisUtils.getLayerList(response) },"layerList"); myWidget.startup(); }); }); </script> </head> <body class="claro"> <div class="container" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:‘headline‘,gutters:false"> <div id="layerListPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:‘right‘"> <div id="layerList"></div> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:‘center‘"></div> </div> </body> </html>
以上是关于ArcGIS API For JavaScript学习笔记的主要内容,如果未能解决你的问题,请参考以下文章
arcgis api for javascript 4.10版本的本地部署
Map学习(arcgis api for javascript3.18)
ArcGIS API for JavaScript学习:第一个地图