arcgis for js 4.x 在线简单调用

基于原生js,jQuery的加载方式,

前提需要了解在线官方api:

https://developers.arcgis.com/javascript/latest/

简单调用代码:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>加载地图</title>
    <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.23/esri/themes/light/main.css"
    />
    <script src="https://js.arcgis.com/4.23/"></script>
    <style>
        html,
        body,
        #map {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }
    </style>
    <script>
        require(["esri/Map",
            "esri/views/MapView",        
            "dojo/domReady!"
        ], function (Map, MapView) {     
            
            var map = new Map({
                basemap: 'gray-vector'
            });
            var view = new MapView({
                container: "view",
                map: map 
            });                    
            
        })
    </script>
</head>

<body>
    <div id="view"></div>
</body>

</html>
View Code

 

posted @ 2022-03-28 14:43  小鱼写代码的过往  阅读(89)  评论(0编辑  收藏  举报