ArcGIS server开发之API for js 本地部署
2016-05-30 00:00
453 查看
ArcGIS Server for javascript 本地部署
第一次使用arcgis server for js开发,在经验方面还有很多的不足,所以将自己在开发过程中遇到的问题写出来与大家共享。有什么不足的地方还望多多指正,共同学习。
一、arcgis arcgis for JavaScript API的下载地址为:http://help.arcgis.com/en/webapi/javascript/arcgis/
二、下载之后的压缩包解压之后
三、将解压的api和sdk要部署到IIS的wwwroot文件夹下面:
需要注意的是,在后边的代码测试中腰键入的文件链接,是将如上图文件夹中问价单独复制出来,放在wwwroot文件夹中,否则会出错。
四、进行相关参数的修改,也可以参考library问价夹下面的install.html文件。
Configuration options for normal build:
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11\init.js in a text editor and search for the text
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11\dojo\dojo.js in a text editor and search for the text
Configuration options for compact build:
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11compact\init.js in a text editor and search for the text
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11compact\dojo.js in a text editor and search for the text
注意:在进行参数替换时,其中的<myserver>为主机名,一般情况下改为localhost。否在修改太麻烦了!
五、完成以上的文件部署后在vs中新建web程序,添加html页,进行测试是否部署成功。
具体的代码如下:
六、测试结果的显示
第一次使用arcgis server for js开发,在经验方面还有很多的不足,所以将自己在开发过程中遇到的问题写出来与大家共享。有什么不足的地方还望多多指正,共同学习。
一、arcgis arcgis for JavaScript API的下载地址为:http://help.arcgis.com/en/webapi/javascript/arcgis/
二、下载之后的压缩包解压之后
三、将解压的api和sdk要部署到IIS的wwwroot文件夹下面:
需要注意的是,在后边的代码测试中腰键入的文件链接,是将如上图文件夹中问价单独复制出来,放在wwwroot文件夹中,否则会出错。
四、进行相关参数的修改,也可以参考library问价夹下面的install.html文件。
Configuration options for normal build:
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11\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.11/3.11/"
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11\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.11/3.11/"
Configuration options for compact build:
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11compact\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.11/3.11compact/"
Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.11\3.11compact\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.11/3.11compact/"
注意:在进行参数替换时,其中的<myserver>为主机名,一般情况下改为localhost。否在修改太麻烦了!
五、完成以上的文件部署后在vs中新建web程序,添加html页,进行测试是否部署成功。
具体的代码如下:
1 <head> 2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 3 <title>地图的加载</title> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 <title>Simple Map</title> 注意:此处的代码为本地部署的调用,其中的文件路径必须正确,否则调试出错。 6 <link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.11/3.11/dijit/themes/tundra/tundra.css"/> 7 <link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.11/3.11/esri/css/esri.css" /> 8 <script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.11/3.11/init.js"></script> 9 <script src="dojo/jsapi_vsdoc10_v33.js" type="text/Javascript"></script> 10 <style type="text/css"> 11 .MapClass { width:900px; height:600px; border:1px solid #000; } 12 </style> 13 <script type="text/Javascript"> dojo.require("esri.map"); 14 dojo.addOnLoad(function () 15 { 16 var MyMap = new esri.Map("MyMapDiv"); 17 var MyTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer 18 ("http://cache1.arcgisonline.cn/ArcGIS/rest/services/ChinaOnlineStreetWarm/MapServer"); 19 MyMap.addLayer(MyTiledMapServiceLayer) 20 }) 21 22 </script> 23 </head> 24 <body class="tundra"> 25 <div id="MyMapDiv" class="MapClass"> 26 27 </div> 29 </body> 30 </html>
六、测试结果的显示
相关文章推荐
- IClient for js开发之地图的加载
- IClient for js开发之地图的加载
- ArcGIS server开发之API for js 本地部署
- IClient for js开发之地图的加载
- IClient for js开发之地图的加载
- 免费jsp服务器eatj使用
- JavaScript 提高性能的几个知识点总结
- Js作用域链及变量作用域
- javascript(一) script 标签
- javascript(二) 事件句柄
- layer.js遇到的问题: layer.open is not a function
- 对javascript对象的理解
- JavaScript碰撞检测原理及其实现
- JavaScript权威指南第一章 概述
- JSON Model转化 - (realm-json使用)
- AnguarJS测试的实施步骤整理
- JavaScript
- 购物车(JS代码)
- jsp语法类型和九大内置对象
- ExtJs 获取Dom对象