测试说明
webgis开发流程一般是: 数据处理 ---发布服务---SDK开发。除了开源的服务以外,一般各GIS厂商都是自己的服务自己的SDK才能对接。
SuperMap iServer 提供了将自己的数据直接发布为arcgis 地图服务的能力,具体步骤参考iserver的帮助文档。既然能转发服务,那arcgis的SDK能否正常对接使用呢?
测试步骤
1、使用SuperMap-iDesktop处理数据,新建地图,保存工作空间。
2、在iServer中发布arcgis地图服务,发布后的服务如下:
3、使用arcgis的js客户端直接使用服务,在web端出图显示正常。如下图:
注:使用的在线SDK,需要*才能加载
<!DOCTYPE html>
<html> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Create Map and add a dynamic layer</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.26/esri/css/esri.css" /> <!-- <link rel="stylesheet" type="text/css" href="library/3.26/3.26/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="library/3.26/3.26/esri/css/esri.css" />
<script type="text/javascript" src="library/3.26/3.26/init.js"></script> --> <!-- <link rel="stylesheet" type="text/css" href="http://localhost:8080/arcgis_js_api/library/3.26/3.26/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost:8080/arcgis_js_api/library/3.26/3.26/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost:8080/arcgis_js_api/library/3.26/3.26/init.js"></script> --> <style>
html, body, #mapDiv{
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script src="https://js.arcgis.com/3.26/"></script> <!-- <script src="library\3.26\3.26\esri\nls\jsapi_zh-cn.js"></script>
<script src="library\3.26\3.26\esri\layers\VectorTileLayer.js"></script>
<script src="library\3.26\3.26\dojox\gfx\svg.js"></script>
<script src="library\3.26\3.26\moment\locale\zh-cn.js"></script> --> <script>
var map; require([
"esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ImageParameters",
"esri/geometry/Extent",
"esri/SpatialReference",
], function (
Map, ArcGISDynamicMapServiceLayer, ImageParameters,Extent,SpatialReference) { map = new Map("mapDiv", {
sliderOrientation : "horizontal"
}); var imageParameters = new ImageParameters();
imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8. var extent= new esri.geometry.Extent(82.8755558959527,26.3247072926332,106.881160373872,45.4578870992914, new SpatialReference({ wkid:4326 })); //Takes a URL to a non cached map service.
var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://localhost:8090/iserver/services/map-123/arcgisrest/map/MapServer", {
id: "base",
"opacity" : 1.0,
"imageParameters" : imageParameters,
"fullExtent": extent,
"disableClientCaching":true
}); map.addLayer(dynamicMapServiceLayer); });
function refresh() {
console.log("刷新动态图层"); var layer= map.getLayer("base");
layer.refresh();
}
</script>
</head> <body>
<div id="toolbar">
<input type='button' id='btn1' value="刷新图层" onclick="refresh()" />
</div>
<div id="mapDiv"></div> </body> </html>