2025年【转载】TMS协议简介

【转载】TMS协议简介tms 协议 TMS 简介 TMS 是 tile map service 的简写 是一种瓦片服务 Tile Map Service 或 TMS 是由开放源码地理空间基金会开发的平铺 web 地图规范 这个定义通常需要一个 URI 结构来尝试实现 REST 原则 TMS 协议填补了 OpenStreetMa 使用的非常简单的标准和 Web 地图服务标准的复杂性之间的空白

大家好,我是讯享网,很高兴认识大家。

3b41e5392705c86f717b05654482ee6f.png

tms协议

TMS简介

TMS是tile map service的简写。是一种瓦片服务。Tile Map Service或TMS是由开放源码地理空间基金会开发的平铺web地图规范。这个定义通常需要一个URI结构来尝试实现REST原则。TMS协议填补了OpenStreetMap使用的非常简单的标准和Web地图服务标准的复杂性之间的空白,提供了简单的URL到分幅,同时还支持备用空间引用系统。

维基百科地址:

https://en.wikipedia.org/wiki/Tile_Map_Service

查看工具

为了能够查看我们的tms是否正常,我们需要寻找一款工具来查看,这里推荐使用QGIs工具。Qgis失败了,可能是tms服务没搞好。

服务的相关文档看下面的介绍。

Tile Map Service Specification

参考网址:

https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification

https://blog.csdn.net/u0/article/details/

https://blog.csdn.net/lp_cq242/article/details/

参考这篇文章,大概可以知道我们的tms服务应该如何去设置

最终需要一个tilemapresource.xml的文件来描述瓦片。

瓦片下载

这里我们采用BIGEMAP地图下载器,下载截图如下:由于是webwgs84 所以我们要设置的纬度到不了90,这是是

85.059

地图采用的是天地图,设置如下:

c1b82d671b3a55f871a8f62fec642ec4.png

下载之后的数据如下:注意我这里原先第一个是1 ,需要修改成0

33c6e131d6d09e42e081e2b6556d5f94.png

TMS服务启动

另外,我们还需要启动tms服务,还需要设置一个文件tilemapresource.xml

内容如下:

<?xml version="1.0" encoding="utf-8"?> <TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"> <Title>NE2_HR_LC_SR_W_DR_recolored.tif</Title> <Abstract></Abstract> <SRS>EPSG:4326</SRS> <BoundingBox miny="-90.00000000000000" minx="-180.00000000000000" maxy="90.00000000000000" maxx="180.00000000000000"/> <Origin y="-90.00000000000000" x="-180.00000000000000"/> <TileFormat width="256" height="256" mime-type="image/png" extension="png"/> <TileSets profile="geodetic"> <TileSet href="0" units-per-pixel="0.000" order="0"/> <TileSet href="1" units-per-pixel="0.000" order="1"/> <TileSet href="2" units-per-pixel="0.000" order="2"/> <TileSet href="3" units-per-pixel="0.000" order="3"/> <TileSet href="4" units-per-pixel="0.0" order="4"/> <TileSet href="5" units-per-pixel="0.0" order="5"/> <TileSet href="6" units-per-pixel="0.0" order="6"/> <TileSet href="7" units-per-pixel="0.00" order="7"/> <TileSet href="8" units-per-pixel="0.005" order="8"/> <TileSet href="9" units-per-pixel="0.0025" order="9"/> <TileSet href="10" units-per-pixel="0.00025" order="10"/> <TileSet href="11" units-per-pixel="3.25e-4" order="11"/> <TileSet href="12" units-per-pixel="1.125e-4" order="12"/> <TileSet href="13" units-per-pixel="8.625e-5" order="13"/> <TileSet href="14" units-per-pixel="4.8125e-5" order="14"/> <TileSet href="15" units-per-pixel="2.4063e-5" order="15"/> <TileSet href="16" units-per-pixel="1.0031e-5" order="16"/> <TileSet href="17" units-per-pixel="5.5156e-6" order="17"/> </TileSets> </TileMap>
讯享网

加载TMS服务

这里我计划采用cesium来加载测试,先下载cesium的js包,然后写一个html文件,但是还是一直出错,原因未知,可能是数据的原因。

讯享网<!DOCTYPE html>
<html lang="en">


<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="Cesium/Cesium.js"></script>
<style>
@import url(Cesium/Widgets/widgets.css);


html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
    }
</style>
</head>


<body>
<div id="cesiumContainer"></div>
<script>
var url = 'http://localhost:8081/'; // tms 瓦片地址 
var viewer = new Cesium.Viewer('cesiumContainer', {
imageryProvider: new Cesium.TileMapServiceImageryProvider({
url: url
      }),
baseLayerPicker: false
    });
</script>
</body>


</html>

让我们来看下我用cesium调用的结果:

b4ea9611d871d390e8ea22b9b196d3b1.png

Cesium示例资源

https://github.com/CesiumGS/cesium/tree/master/Source/Assets/Textures/NaturalEarthII

cesium提供了示例的格式,我们可以用这个来参考填写。

小讯
上一篇 2025-03-12 17:17
下一篇 2025-01-06 10:14

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/91706.html