arcgis 4.3离线调用

1、下载4.3api,将文件夹放在C:\inetpub\wwwroot下,目录如下:C:\inetpub\wwwroot\4.3\4.3

2、复制4.3文件夹至vs项目管理中


3、修改init.js和dojo/dojo.js文件

如图所示,当然要修改vs指定端口,属性中修改


4、代码需要加 djConfig="parseOnLoad: true


我的测试代码如下html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Get started with SceneView - Create a 3D map</title>
<style>
  html, body, #viewDiv {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
  }
</style>
<link rel="stylesheet" href="http://localhost:5374/4.3/4.3/esri/css/main.css">




<script type="text/javascript" src="http://localhost:5374/4.3/4.3/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script type="text/javascript" src="http://localhost:5374/4.3/4.3/init.js"></script>






<script>
require([
 "esri/config", 
 "esri/core/urlUtils",
  "esri/Map",
  "esri/views/SceneView",
  "esri/layers/FeatureLayer",  
  "dojo/domReady!"
], function(esriConfig,urlUtils,Map, SceneView,FeatureLayer){


// esriConfig.request.proxyUrl = "<url_to_proxy>";
// <!-- esriConfig.defaults.io.alwaysUseProxy = false; -->
// urlUtils.addProxyRule({
//  urlPrefix: "route.arcgis.com",
//  proxyUrl: "<url_to_proxy>"
// });
 
var featureLayer = new FeatureLayer("http://192.168.106.33:6080/arcgis/rest/services/province84/MapServer/0",{})
  var map = new Map({
    basemap: "streets",
    ground: "world-elevation",
layers:[featureLayer]
  });
  var view = new SceneView({
    container: "viewDiv",     // Reference to the scene div created in step 5
    map: map,                 // Reference to the map object created before the scene
    scale: 50000000,          // Sets the initial scale to 1:50,000,000
    center: [121, 35]  // Sets the center point of view with lon/lat
  });
});
</script>
</head>
<body>
  <div id="viewDiv"></div>
</body>
</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值