您的位置:首页 > Web前端 > JavaScript

ArcGIS API For JavaScript 安装部署说明

2018-02-26 15:57 549 查看
首先,在eclipse中新建一个名称叫GisTest的web项目将文件夹arcgis_api_for_js复制到 WebContent 下面
第二步,修改init.js 和dojo.js文件将:
[HOSTNAME_AND_PATH_TO_JSAPI] 
修改为: http://localhost:8080/GisTest/arcgis_js_api/library/3.23/3.23/
第三步,编写测试文件index.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:8080/GisTest/arcgis_js_api/library/3.23/3.23/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost:8080/GisTest/arcgis_js_api/library/3.23/3.23/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost:8080/GisTest/arcgis_js_api/library/3.23/3.23/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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: