其他分享
首页 > 其他分享> > arcgis for js 4.x (动态服务加载MapImageLayer)

arcgis for js 4.x (动态服务加载MapImageLayer)

作者:互联网

<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
        <title>地图加载</title>
        <style>
            html,
            body,
            #viewDiv {
                padding: 0;
                margin: 0;
                height: 800px;
                width: 800px;
                overflow: hidden;
            }
        </style>
        <link rel="stylesheet" href="https://js.arcgis.com/4.23/esri/css/main.css" />
        <script src="https://js.arcgis.com/4.23/init.js"></script>
        <script>
            require(["esri/Map",
                "esri/views/MapView",
                "esri/layers/MapImageLayer",
            ], function(
                Map,
                MapView,
                MapImageLayer,
            ) {

                var map = new Map({
                    //basemap: 'osm'
                });


                var view = new MapView({
                    container: "viewDiv",
                    map: map,                    
                });
                
                let layer = new MapImageLayer({
                    url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer"
                  });
                map.add(layer); 


            });
        </script>
    </head>

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

 

标签:map,arcgis,js,MapImageLayer,new,MapView,Map,esri
来源: https://www.cnblogs.com/hjyjack9563-bk/p/16067699.html