arcgis js api开发环境搭建(Tomcat)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wo_buzhidao/article/details/79627885

arcgis js api开发环境搭建(Tomcat)

  • 环境
    arcgis for API 4.6,tomcat 7

  • 下载api
    在官网下载arcgis for js 4.6 api 和tomcat

  • 搭建步骤
    1.将下载的arcgis for js api移动到tomcat webspps文件下;
    2.找到文件夹”D:\apache-tomcat-7.0.73\webapps\arcgis_js_v46_api\arcgis_js_api\library\4.6”init.js文件
    3.利用记事本或EditPlus打开;Ctrl+F组合键查找[HOSTNAME_AND_PATH_TO_JSAPI],并替换为127.0.0.1:8080/arcgis_js_v46_api/arcgis_js_api/library/4.6/
    4.找到文件D:\apache-tomcat-7.0.73\webapps\arcgis_js_v46_api\arcgis_js_api\library\4.6\dojo中的dojo.js文件
    5.利用记事本或EditPlus打开;Ctrl+F组合键查找[HOSTNAME_AND_PATH_TO_JSAPI],并替换为127.0.0.1:8080/arcgis_js_v46_api/arcgis_js_api/library/4.6/
    6.启动tomcat即可使用;
  • 搭建完成代码测试
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Intro to MapView - Create a 2D map</title>
    <link rel="stylesheet" href="http://127.0.0.1:8080/arcgis_js_v46_api/arcgis_js_api/library/4.6/esri/css/main.css">
    <script src="http://127.0.0.1:8080/arcgis_js_v46_api/arcgis_js_api/library/4.6/init.js"></script>
    <style>
        html, body, #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>
</head>

<body>
    <div id="viewDiv">
    </div>
</body>
<script>
    require([
        "esri/Map",
        "esri/views/MapView",
        "dojo/domReady!"
    ], function(Map, MapView) {
        var map = new Map({
            basemap: "streets"
        });
        var view = new MapView({
            container: "viewDiv",  
            map: map,               
            zoom: 4,  
            center: [15, 65]  
        });
    });
</script>
</html>
  • 地图显示
    这里写图片描述

猜你喜欢

转载自blog.csdn.net/wo_buzhidao/article/details/79627885