首页 > 代码库 > Arcgis API For Javascript下载与安装

Arcgis API For Javascript下载与安装

本文以3.9版本为示例

1.最新API下载地址:http://support.esrichina-bj.cn/2011/0223/960.html

2.解压缩包:arcgis_js_v39_api.zip

3.复制解压出来的Library到C:\Inetpub\wwwroot\arcgis_js_api\library(arcgis_js_api文件夹若没有自己创建)

4.打开 C:\Inetpub\wwwroot\arcgis_js_api\library\3.9\3.9\init.js 替换[HOSTNAME_AND_PATH_TO_JSAPI] 为 "<myserver>/arcgis_js_api/library/3.9/3.9/"

5.打开C:\Inetpub\wwwroot\arcgis_js_api\library\3.9\3.9\js\dojo\dojo\dojo.js替换[HOSTNAME_AND_PATH_TO_JSAPI]为 "<myserver>/arcgis_js_api/library/3.9/3.9/"

6.测试网页

<!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://<myserver>/arcgis_js_api/library/3.9/3.9/js/dojo/dijit/themes/tundra/tundra.css"/>
    <link rel="stylesheet" type="text/css" href="http://<myserver>/arcgis_js_api/library/3.9/3.9/js/esri/css/esri.css" />
    <script type="text/javascript" src="http://<myserver>/arcgis_js_api/library/3.9/3.9/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>