SuperMap iClient如何使用WMTS地图服务
SuperMap iClient如何使用WMTS地图服务
什么是WMTS服务
WMTS,切片地图Web服务(Web Map Tile Service)当前版本是1.0.0。该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMTS 实现规范。
WMTS 是 OGC 提出的缓存技术标准,即在服务器端缓存被切割成一定大小瓦片的地图,对客户端只提供这些预先定义好的单个瓦片的服务,将更多的数据处理操作如图层叠加等放在客户端,从而缓解 GIS 服务器端数据处理的压力,改善用户体验。
如何使用WMTS地图服务
本文将对iServer的WMTS服务, 天地图的WMTS服务, ArcGIS的WMTS服务进行剖析
1.针对iServer发布的WMTS服务
针对iServer Java 6R发布的WMTS,我们在使用iClinet对接时,需要注意以下几个参数,这里我用iClinet for JavaScript代码作为示范:
|
layer = new SuperMap.Layer.WMTS({name: "World", url: http://localhost:8090/iserver/services/map-world/wmts100 //WMTS服务地址 layer: "World", //图层名称 style: "default", //图层样式 matrixSet: "GlobalCRS84Scale_World", //发布的标识符矩阵集 format: "image/png", //图像的MIME类型,默认为 "image/png" resolutions:resolutions, //地图分辨率 opacity: 1, requestEncoding:"KVP"}); //请求编码 ,一般默认都是KVP |
综合上面红色字体的部分,我们可以得出,如果是iServer发布的地图,除地图url外,我们需要获取以上5个属性,那么究竟如何获取这5个属性呢?
获取方法:
1. 首先,启动iServer6R
2. 其次浏览器中输入: http://localhost:8090/iserver/services/map-world/wmts100 然后回车
3. 搜索Contents节点,我们可以获取所需4个属性
|
<Contents> <Layer> <ows:Title>World</ows:Title> <ows:Identifier>World</ows:Identifier> <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84"> <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner> <ows:UpperCorner>180.0 90.0</ows:UpperCorner> </ows:WGS84BoundingBox> <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::3857"> <ows:LowerCorner>-2.0037508342789244E7 -2.0037508342789236E7</ows:LowerCorner> <ows:UpperCorner>2.0037508342789244E7 2.0037508342789244E7</ows:UpperCorner> </ows:BoundingBox> <Style isDefault="true"> <ows:Identifier>default</ows:Identifier> </Style> <Format>image/png</Format> <TileMatrixSetLink> <TileMatrixSet>Custom_World</TileMatrixSet> </TileMatrixSetLink> <TileMatrixSetLink> <TileMatrixSet>GlobalCRS84Scale_World</TileMatrixSet> </TileMatrixSetLink> <TileMatrixSetLink> <TileMatrixSet>GoogleMapsCompatible_World</TileMatrixSet> </TileMatrixSetLink> <ResourceURL format="image/png" resourceType="tile" template="http://localhost:8090/iserver/services/map-world/wmts100/ World/default/Custom_World/{TileMatrix}/{TileRow}/{TileCol}.png"/> <ResourceURL format="image/png" resourceType="tile" template="http://localhost:8090/iserver/services/map-world/wmts100/ World/default/GlobalCRS84Scale_World/{TileMatrix}/{TileRow}/{TileCol}.png"/> <ResourceURL format="image/png" resourceType="tile" template="http://localhost:8090/iserver/services/map-world/wmts100/ \World/default/GoogleMapsCompatible_World/{TileMatrix}/{TileRow}/{TileCol}.png"/> </Layer> |
从高亮的部分,可以得出以下对应情况
|
WMTS服务参数 |
iClinet for JavaScript代码 |
|
<ows:Title>World</ows:Title> |
layer: "World" |
|
<ows:Identifier>default</ows:Identifier> |
style: "default" |
|
<TileMatrixSet>GlobalCRS84Scale_World</TileMatrixSet> |
matrixSet: "GlobalCRS84Scale_World" |
|
format="image/png" |
format: "image/png" |
4. 最后在根据自己地图,计算当前图层的分辨率数组信息.如本范例分辨率数组是:
|
var resolutions = [1.25764139776733,0.628820698883665,0.251528279553466, 0.125764139776733,0.0628820698883665,0.0251528279553466, 0.0125764139776733,0.00628820698883665,0.00251528279553466, 0.00125764139776733,0.000628820698883665,0.000251528279553466, 0.000125764139776733,0.0000628820698883665,0.0000251528279553466, 0.0000125764139776733, 0.00000628820698883665,0.00000251528279553466, 0.00000125764139776733,0.000000628820698883665,0.000000251528279553466]; |
最终效果图:

2.针对天地图官网发布的WMTS服务
针对天地图官网发布的WMTS服务,我们在使用iClinet对接时,需要注意以下几个参数,这里我用iClinet for JavaScript代码作为示范:
1. 天地图官网公布的WMTS服务地址,请查看http://www.tianditu.cn/guide/index.html

2. 我选取http://t0.tianditu.com/vec_c/wmts为服务地址, 搜索Contents节点,获取4个重要信息:
|
<Contents> <Layer> <ows:Title>cva</ows:Title> <ows:Abstract>cva</ows:Abstract> <ows:Identifier>cva</ows:Identifier> <ows:WGS84BoundingBox> <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner> <ows:UpperCorner>180.0 90.0</ows:UpperCorner> </ows:WGS84BoundingBox> <ows:BoundingBox> <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner> <ows:UpperCorner>180.0 90.0</ows:UpperCorner> </ows:BoundingBox> <Style> <ows:Identifier>default</ows:Identifier> </Style> <Format>tiles</Format> <TileMatrixSetLink> <TileMatrixSet>c</TileMatrixSet> </TileMatrixSetLink> </Layer> <TileMatrixSet> <ows:Identifier>c</ows:Identifier> <ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS> |
从高亮的部分,可以得出以下对应情况
|
天地图官网WMTS服务参数 |
iClinet for JavaScript代码 |
|
<ows:Title>cva</ows:Title> |
layer: "vec" |
|
<ows:Identifier>default</ows:Identifier> |
style: "default" |
|
<TileMatrixSet>c</TileMatrixSet> |
matrixSet: "c" |
|
<Format>tiles</Format> |
format: "tiles" |
由于此天地图官网提供的WMTS服务,为全球经纬度范围(东西经±180度,南北纬±90度),则不需要设置原点和全副范围.
那么在iClinet for JavaScript代码中可以这样写:
|
layer = new SuperMap.Layer.WMTS({name: "vec", url: "http://t0.tianditu.com/vec_c/wmts", layer: "vec", style: "default", matrixSet: "c", format: "tiles", opacity: 1, requestEncoding:"KVP"}); |
最终效果图:

当然如果再叠加一幅中文标记wmts地图(该步骤同上述步骤相似,请开发人员自己尝试),最终效果:

3.针对ArcGIS发布的WMTS服务
针对ArcGIS发布的WMTS,我们在使用iClinet对接时,需要注意以下几个参数,这里我用iClinet for JavaScript代码作为示范:
1. 使用ArcGIS发布地图服务,切缓存 (此步骤略) 出图正常

2. 得到ArcGIS的WMTS服务地址, (http://localhost:6080/arcgis/rest/services/china/MapServer/wmts)搜索Contents节点,获取6个重要信息:
|
<Contents> <!-- Layer --> <Layer> <ows:Title>china</ows:Title> <ows:Identifier>china</ows:Identifier> <ows:BoundingBox crs="urn:ogc:def:crs:EPSG::0"> <ows:LowerCorner>73.62004852294922 3.8537260781998635</ows:LowerCorner> <ows:UpperCorner>134.76846313476562 53.553741455078125</ows:UpperCorner> </ows:BoundingBox> <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84"> <ows:LowerCorner>73.62004852294922 3.8537260781998635</ows:LowerCorner> <ows:UpperCorner>134.76846313476562 53.553741455078125</ows:UpperCorner> </ows:WGS84BoundingBox> <Style isDefault="true"> <ows:Title>Default Style</ows:Title> <ows:Identifier>default</ows:Identifier> </Style> <Format>image/png</Format> <TileMatrixSetLink> <TileMatrixSet>default028mm</TileMatrixSet> </TileMatrixSetLink> <TileMatrixSetLink> <TileMatrixSet>nativeTileMatrixSet</TileMatrixSet> </TileMatrixSetLink> <ResourceURL format="image/png" resourceType="tile" template="http://localhost:6080/arcgis/rest/services/china/MapServer/WMTS /tile/1.0.0/china/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/> </Layer> 以及矩阵原点属性 <TileMatrix> <ows:Identifier>0</ows:Identifier> <ScaleDenominator>6.047619047619047E7</ScaleDenominator> <TopLeftCorner>-400.0 400.0</TopLeftCorner> <TileWidth>256</TileWidth> <TileHeight>256</TileHeight> <MatrixWidth>2</MatrixWidth> <MatrixHeight>3</MatrixHeight> |
从高亮的部分,可以得出以下对应情况
|
ArcGIS WMTS服务参数 |
iClinet for JavaScript代码 |
|
<ows:Title>china</ows:Title> |
layer: "china" |
|
<ows:Identifier>default</ows:Identifier> |
style: "default" |
|
<TileMatrixSet>default028mm</TileMatrixSet> |
matrixSet: "default028mm" |
|
<Format>image/png</Format> |
format: "image/png" |
|
<ows:LowerCorner>73.62004852294922 3.8537260781998635</ows:LowerCorner> <ows:UpperCorner>134.76846313476562 53.553741455078125</ows:UpperCorner> |
tileFullExtent: new SuperMap.Bounds( 73.62004852294922, 3.8537260781998635, 134.76846313476562, 53.553741455078125) |
|
<TopLeftCorner>-400.0 400.0</TopLeftCorner> |
tileOrigin:new SuperMap.LonLat(-400,400) |
3. 获取ArcGIS所切图层的分辨率,访问地图rest服务(http://localhost:6080/arcgis/rest/services/china/MapServer )我们可以获取resolutions
那么在iClinet for JavaScript中完整代码可以这样写
|
var resolutions = [0.15228550437351568,0.07614275218675784,0.03807137609337892,0.01903568804668946,0.00951784402334473]; //分辨率 var maxExtent = new SuperMap.Bounds(73.62004852294922,3.8537260781998635,134.76846313476562,53.553741455078125); //全副范围 layer = new SuperMap.Layer.WMTS({name: "china", url: "http://localhost:6080/arcgis/rest/services/china/MapServer/wmts" layer: "china", style: "default", matrixSet: "default028mm", format: "image/png", resolutions:resolutions, opacity: 1, tileFullExtent:maxExtent, //瓦片设置的最大范围 tileOrigin:new SuperMap.LonLat(-400,400), //瓦片矩阵左上角 requestEncoding:"KVP" }); |
最终效果图:

注意:在对接ArcGIS wmts服务时:
1. 需要设置瓦片设置的最大范围(全副范围)
2. 需要设置瓦片矩阵左上角 (如果不出图,有时候需要根据请求瓦片行列号,微调这个值)
3. 需要设置分辨率
(转贴请注明出处:http://www.cnblogs.com/zhangyongli2011/ 如发现有错,请留言 谢谢)
SuperMap iClient如何使用WMTS地图服务的更多相关文章
- SuperMap iClient 如何使用 WMTS 地图服务(转载)
原文链接: WMTS服务初步理解与读取 https://blog.csdn.net/supermapsupport/article/details/76806670 SuperMap iClient ...
- SuperMap iClient如何使用WMTS地图服务(转)
http://blog.sina.com.cn/s/blog_6259ebd50102v221.html 什么是WMTS服务 WMTS,切片地图Web服务(Web Map Tile Service)当 ...
- SuperMap iClient如何使用WMS地图服务
什么是WMS服务 WMS(Web Map Service,Web 地图服务)服务,该服务符合 OGC(Open Geospatial Consortium,开放地理信息联盟)制定的 WMS 实现规范. ...
- SuperMap iClient for JavaScript 新手入门
地理信息系统(英语:Geographic Information System,缩写:GIS)是一门综合性学科,结合地理学与地图学,已经广泛的应用在不同的领域,是用于输入.存储.查询.分析和显示地理数 ...
- SuperMap iClient 7C——网络客户端GIS开发平台 产品新特性
SuperMap iClient 7C是空间信息和服务的可视化交互开发平台,是SuperMap服务器系列产品的统一客户端.产品基于统一的架构体系,面向Web端和移动端提供了多种类型的SDK开发包,帮助 ...
- SuperMap iClient
SuperMap iClient 7C——网络客户端GIS开发平台 产品新特性 SuperMap iClient 7C是空间信息和服务的可视化交互开发平台,是SuperMap服务器系列产品的统一客 ...
- Skyline中加载WMTS地图
Skyline中默认是Bing地图,必应虽然免费无偏移,但在国内的影像质量并不是很好.不用担心,Skyline支持多种影像图层,包括WFS.WMS.WMTS地图服务.使用地图作为底图有两个好处: (1 ...
- 不偏移的天地图地图服务-SuperMap版
在<不偏移的天地图地图服务-ArcGIS版>中,提供了相应的服务地址:而SuperMap中,则是将纠偏的方法集成到程序中,只需要修改一个配置参数,则可以实现天地图的纠偏. 打开Web型数据 ...
- 常见地图服务(WMS、WFS、WCS、TMS、WMTS
1.网络地图服务(WMS) 网络地图服务(WMS)利用具有地理空间位置信息的数据制作地图.其中将地图定义为地理数据可视的表现.能够根据用户的请求返回相应的地图(包括PNG,GIF,JPEG等栅格形式或 ...
随机推荐
- JZYZOJ1452 NOIP2015_提高组Day2_1_跳石头
http://172.20.6.3/Problem_Show.asp?id=1452很简单的二分,最开始以为是优先队列,想了想发现优先队列是有情况不能达到最优的,所以二分+贪心处理,在贪心check的 ...
- [2018湖南省队集训] 6.24 T1 marshland
题面在这里! 一开始感觉像一个类似二分图的最小割,于是成功跑偏2333333 很容易发现一个关键性质,'L'的两个角落在的偶数格 的行(或者列)的奇偶性一定不同.... 于是我们再把偶数格按照行(或者 ...
- 【深搜+set使用学习】POJ3050-Hopscotch
[题目大意] 给出一个5*5的方格,求出从任意一点出发走6步组成的不同序列数. [思路] dfs的水题,当作set使用方法的初次学习.每次从任意一点出发进行一次dfs,将序列加入set,最后输出set ...
- 一个简单的Spring程序
首先,要用Eclipse开发Spring程序,需要安装Spring插件并重启Eclipse 具体操作: 新建java Project后,导入需要使用的包(提前下好Spring),Spring包包含6个 ...
- Error attempting to get column 'xxx' from result set. Cause: java.sql.SQLException: 无法转换为内部表示
因为<resultMap>中映射的实体类属性类型与数据库字段类型不一致造成的.
- HDU 5631 Rikka with Graph 暴力 并查集
Rikka with Graph 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5631 Description As we know, Rikka ...
- leetcode 564. Find the Closest Palindrome
leetcode564题目地址 Given an integer n, find the closest integer (not including itself), which is a pali ...
- java中关于volatile的理解疑问?
作者:xyzZ链接:https://www.zhihu.com/question/49656589/answer/117826278来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...
- Objective-C]入门 (xcode helloworld程序 创建类
一:objective-c简介 Objective-C是进行iPhone软件开发的语言 Objective-C语言是C语言的一个扩展集 Objective-C是一种面向对象的语言 大小写敏感 程序语句 ...
- OpenCV腐蚀与膨胀(Eroding and Dilating)
腐蚀与膨胀(Eroding and Dilating) 目标 本文档尝试解答如下问题: 如何使用OpenCV提供的两种最基本的形态学操作,腐蚀与膨胀( Erosion 与 Dilation): ero ...