ARCGIS JAVASCRIPT API (3.2)部署

前期做地图开发用的API 是SILVERLIGHT  项目需要,学习下JS API

首先从官方下载最新的API包 3.2一共有2个压缩包API:arcgis_js_v32_api.zip和arcgis_js_v32_sdk.zip

解压arcgis_js_v32_api,在library文件夹下可以看到安装说明文件install.htm

下一步 根据安装说明进行配置。

部署步骤1:将解压缩后的文件目录拷贝到web服务器网站根目录下,这里使用IIS。根目录。C:\Inetpub\wwwroot

拷贝后的文件目录结构为

C:\Inetpub\wwwroot\arcgis_js_api\library

部署步骤2:修改全局变量[HOSTNAME_AND_PATH_TO_JSAPI] ,EditPlus或则DW都可以 查找替换为localhost/library/3.2/jsapi 和localhost/library/3.2/jsapicompact

如果端口不是80 需要加上端口号 (localhost:端口)

Configuration options for normal build:

  1. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.2\jsapi\init.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.2/jsapi/"
  2. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.2\jsapi\js\dojo\dojo\dojo.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.2/jsapi/"

Configuration options for compact build:

  1. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.2\jsapicompact\init.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace each instance of this text with "<myserver>/arcgis_js_api/library/3.2/jsapicompact/"
  2. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.2\jsapicompact\js\dojo\dojo\dojo.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.2/jsapicompact/"

 步骤3: 测试是否发布成功,官方的安装说明文件中给出了完成的测试代码

 

复制代码
<! 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.2/jsapi/js/dojo/dijit/themes/tundra/tundra.css" />
     < link  rel ="stylesheet"  type ="text/css"  href ="http://<myserver>/arcgis_js_api/library/3.2/jsapi/js/esri/css/esri.css"   />

     < script  type ="text/javascript"  src ="http://<myserver>/arcgis_js_api/library/3.2/jsapi/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 >
复制代码

放到IIS目录里运行下试试,如果地图可以正常显示 则表示部署成功 。

注意:官方测试代码给出的地图服务是缓存地图,如果地图服务是动态地图话需要使用动态图层ArcGISDynamicMapServiceLayer才能显示。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值