关于GIS中Scale和Resolution的那些事儿

       在ArcMap或各种前端地图框架(Leaflet.js、OpenLayers.js、ArcGIS Javascript等)中都须要加载WMTS或ArcGIS Rest服务,但全部的地图显示的原理基本上都是经过坐标和每张瓦片的分辨率来计算行列号的,但WMTS服务标准中实际上是没有分辨率Resolution这个参数的,他只给出了比例尺“ScaleDenominator”这个值,须要用户根据这个比例尺本身计算出分辨率。(参考下图,为同一个瓦片服务的Rest服务和WMTS服务)html

REST:http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer前端

WMTS:https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xmlapp

同一份瓦片在ArcGIS Rest和WMTS中不同的比例尺表示

       但在ArcGIS Rest服务中你会发现服务的Lod信息里是同时给出了比例尺“Scale”和分辨率“Resolution”值了的。有心读者读到这里和看到下面的图片时,应该会有两个疑惑。框架

  1. Resolution和Scale的计算公式是什么?
  2. 为何同一份已经切好了的瓦片,在ArcGIS Rest服务和WMTS服务的比例尺不同?

 

1、Scale和 Resolution的计算公示this

案例一:若是地图的坐标单位是米,dpi为96.net

 参考: https://blog.csdn.net/redsky200905/article/details/84369213unix

 

1英寸=2.54厘米;rest

1英寸=96像素;server

最终换算的单位是米;xml

若是当前地图比例尺为1:125000000,则表明图上1米实地125000000米;

米和像素间的换算公式:

1英寸=0.0254米=96像素

1像素=0.0254/96 米

则根据1:125000000比例尺,图上1像素表明实地距离是 125000000*0.0254/96 = 33072.9166666667米。

 

以上图第0级为例,比例尺为 Scale=591657527.591555,Resolution=156543.03392800014

 

591657527.591555*0.0254/96 =156,542.7208419323

591657527.591555*0.0254000508/96 =156,543.0339273739

 

咱们这个换算结果和切片的结果略微有0.07米的偏差。这个偏差产生的缘由是英寸换算厘米的参数决定的,server使用的换算参数1英寸约等于0.0254000508米。

 

       关于1英寸单位换算有如下文献说明

 

参考:http://scienceworld.wolfram.com/physics/Inch.html

        An nonmetric unit of length, originally defined as the lengths of three "average size" barleycorns laid end-to-end, but now more rationally defined as 2.54 cm. An older definition no longer used was 1 meter= 39.37 inches, giving 2.54000508 cm/inch.

12 inches are called 1 foot.

 

案例二:若是地理坐标系是wgs84,地图的单位是度,dpi为96

 经纬度坐标系的比例尺和分辨率

       Server中度和米之间的换算参数: 1 度约等于 111194.872221777 米

接下来就须要进行度和像素间的换算:

当比例尺为1:64000000米时,至关于1像素 = 64000000*0.0254000508/96 = 16933.3672米,再将米转换为度 16933.3672/ 111194.872221777 = 0.1522855043731385 度

 

       所以当地图单位为度时,近似计算在1:64000000 对应的Resolution为0.1522855043731385度。

 

 2、WMTS服务中的Scale和ArcGIS Rest服务中不同的缘由

       最核心的缘由是由于DPI计算方式不同!!!

WMTS assumes a DPI 90.7 instead of 96 as is clearly documented in the WMTSCapabilities document which states,

        "The tile matrix set that has scale values calculated based on the dpi defined by OGC specification (dpi assumes 0.28mm as the physical distance of a pixel)."

0.28 mm per pixel = 0.0110236 inches per pixel or 90.71446714322 pixels per inch.

       If you replace 96 in the equation above with 90.71428571429 you'll get the ScaleDenominator value so ESRI used a different conversion constant. After a little research I learned that

        1 in = 2.54 cm (I thought this was an approximation but it's by definition)

Since there are 25.4 mm in one inch then 25.4 / .28 = 90.71428571429 DPI which is the value we're after for DPI. Here is a site which confirms this calculation.

 

       继续以第一图为例:

 

559082264.0285016 * 0.00028 = 156,543.0339279804,这样计算的结果就和ArcGIS Rest中的差很少保持一致了。

 

 

参考文献:

https://blog.csdn.net/redsky200905/article/details/84369213

https://gis.stackexchange.com/questions/123195/why-are-rest-lod-scales-different-to-the-wmts-capabilities-xml

 https://gis.stackexchange.com/questions/29671/mathematics-behind-converting-scale-to-resolution/29733#29733

相关文章
相关标签/搜索