ArcGis API for JavaScript 3.14 基于tomcat配置
一般引用ArcGIS API for JavaScript开发有两种方式:一种是直接引用官方提供的API地址(http://js.arcgis.com/3.14/),另外一种是自己发布一个本地的API服务,下面介绍一下在本机发布一个本地的API服务。
第一步:到 https://developers.arcgis.com/en/downloads/ 网站下载API,需要注册eari的账户才能下载,进入网站后找到ArcGIS Web SDKs 下的ArcGIS API for JavaScript选择版本后,点击进行下载。或者到链接:http://pan.baidu.com/s/1pJL4YuB 密码:m9d4 下载。
第一处,用文本编辑器打开3.14\init.js文件,Ctrl+F全文搜索[HOSTNAME_AND_PATH_TO_JSAPI],将其替换为localhost:8090/jspai/3.14,
第四步,启动Tomcat,双击运行D:\Tomcat\bin\startup.bat。
- </pre><pre name="code" class="html"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>Simple Map</title>
- <link rel="stylesheet" type="text/css" href="http://localhost:8090/jsapi/3.14/dijit/themes/tundra/tundra.css"/>
- <link rel="stylesheet" type="text/css" href="http://localhost:8090/jsapi/3.14/esri/css/esri.css" />
- <script type="text/javascript" src="http://localhost:8090/jsapi/3.14/init.js"></script>
- <script type="text/javascript">
- dojo.require("esri.map");
- function init() {
- var myMap = new esri.Map("mapDiv");
- //note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.
- var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
- myMap.addLayer(myTiledMapServiceLayer);
- }
- dojo.addOnLoad(init);
- </script>
- </head>
- <body class="tundra">
- <div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
- </body>
- </html>
成功显示:
转自:http://blog.csdn.net/u013274055/article/details/49382661