设置代理调用WMTS服务
一、数据准备
1、链接:http://pan.baidu.com/s/1sjzCytR 密码:uugc,下载DotNet版本
2、 发布切片服务,打开ogc服务可产看到相应的符合ogc标准的服务,如下选择WMTS服务
二、调用
1、拷贝DottNet版本中的文件到C:\inetpub\wwwroot\proxy(部分文件需要新建)【图1】,用记事本打开proxy.config
图1
2、按【图2】添加
<serverUrl url="http://localhost:6080/arcgis/rest/services"
matchAll="true"/>
到特定位置,保存关闭即可
3、 在C:\inetpub\wwwroot路径下新建tests.html[可在别的IDE中新建html文档然后发布到IIS中也是一样的效果],用记事本打开,写入如下内容
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior
of the samples on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Add WMTS Layer</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{
padding: 0;
}
#citationInfo{
position:absolute;
color:black;
font-weight:bold;
font-size:12pt;
left:10px;
bottom:10px;
z-Index:999;
}
</style>
<script src="http://js.arcgis.com/3.13/"></script>
<script>
var map;
require([
"esri/map", "esri/layers/WMTSLayer", "esri/layers/WMTSLayerInfo",
"esri/config",
"dojo/domReady!"
], function(
Map, WMTSLayer, WMTSLayerInfo,
esriConfig
) {
esriConfig.defaults.io.proxyUrl = "/proxy/proxy.ashx";
map = new Map("map");
var layerInfo = new WMTSLayerInfo({
identifier: "test_MyMapService",
format: "png"
});
var options = {
serviceMode: "KVP",
layerInfo: layerInfo
};
var wmtsLayer = new WMTSLayer("http://localhost:6080/arcgis/rest/services/test/MyMapService/MapServer/WMTS", options);
map.addLayer(wmtsLayer);
});
</script>
</head>
<body>
<div id="map">
<div id="citationInfo">
</div>
</div>
</body>
</html>
开始浏览该服务
浏览器中显示如下










浙公网安备 33010602011771号