ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

二维瓦片的相关概念

二维瓦片的相关概念

概念

正射影像

正射影像是一种经过几何纠正(比如使之拥有统一的比例尺)的航摄像片,与没有纠正过的航摄像片不同的是,人们可以使用正射影像量测实际距离,因为它是通过校正透视变形后得到的地球表面的真实描述。 与传统的地形图相比,正射影像或正射影像图(DOM)具有资讯量大、形象直观、易于判读和现势性强等诸多优点,因而常被应用到地理信息系统(GIS)中。

参考:https://zh.wikipedia.org/wiki/正射影像

Web-Mercator投影

墨卡托投影(英语:Mercator projection,另称正轴等角圆柱投影)是一种等角的圆柱形地图投影法。其得名于法兰德斯地理学家杰拉杜斯·墨卡托,他于1569年发表长202厘米、宽124厘米以此方式绘制的世界地图。该地图将地球在平面展开,经纬线于任何位置皆垂直相交,使地图形成一个简洁的长方形,地图的任一点在各种方向的长度均相等。由于可显示任意两点间的正确方位及经纬度,航海用途的海图、航路图大都以此方式绘制。在该投影中线型比例尺在图中任意一点周围都保持不变,从而可以保持大陆轮廓投影后的角度和形状不变(即等角)。

墨卡托投影的缺点是其会使高纬度地区面积变形失真,纬度越高变形越严重:赤道地区几乎没有变形问题,但接近南北极的高纬度地区(如格陵兰)面积可被失真放大数倍之多。虽则如此,但因为大部分国际航线均位于南北回归线之间的低纬度地带,墨卡托投影法于该等区域中的变形程度尚算可接受,故仍被广泛应用为目前世上最普及的地图投影法。

投影公式推导

目标:从球面几何与局部保角条件,推导球面墨卡托投影F : ( λ , φ ) ↦ ( x , y ) F:(\lambda,\varphi)\mapsto(x,y)F:(λ,φ)↦(x,y)。

假设:地球为半径R RR的球体;经度λ \lambdaλ、纬度φ \varphiφ均以弧度表示;中央经线为0 00;赤道投影为y = 0 y=0y=0。纬度范围− π / 2 < φ < π / 2 -\pi/2<\varphi<\pi/2−π/2<φ<π/2。

1. 从圆弧长度建立球面上的微小距离

基本公式为s = r θ s=r\thetas=rθ,其中θ \thetaθ用弧度表示。

  • 东西方向:

d s E = R cos ⁡ φ d λ ds_E=R\cos\varphi\,d\lambdadsE​=Rcosφdλ

  • 南北方向:

d s N = R d φ ds_N=R\,d\varphidsN​=Rdφ

2. 设定投影形式与约束

满足平面东西距离 地球东西距离 = 平面南北距离 地球南北距离 \frac{平面东西距离}{地球东西距离}=\frac{平面南北距离}{地球南北距离}地球东西距离平面东西距离​=地球南北距离平面南北距离​

k E = d x d s E = R d λ R cos ⁡ φ d λ = 1 cos ⁡ φ k_E=\frac{dx}{ds_E}=\frac{R\,d\lambda}{R\cos\varphi\,d\lambda}=\frac{1}{\cos\varphi}kE​=dsE​dx​=RcosφdλRdλ​=cosφ1​

k N = d y d s N = f ′ ( φ ) d φ R d φ = f ′ ( φ ) R k_N=\frac{dy}{ds_N}=\frac{f'(\varphi)\,d\varphi}{R\,d\varphi}=\frac{f'(\varphi)}RkN​=dsN​dy​=Rdφf′(φ)dφ​=Rf′(φ)​

令k E = k N k_E=k_NkE​=kN​,得到要解的一阶常微分方程:

d y d φ = R cos ⁡ φ = R sec ⁡ φ \boxed{\frac{dy}{d\varphi}=\frac{R}{\cos\varphi}=R\sec\varphi}dφdy​=cosφR​=Rsecφ​

3. 分离变量,积分求解

将方程写成微分形式:

d y = R sec ⁡ φ d φ dy=R\sec\varphi\,d\varphidy=Rsecφdφ

两侧积分:

y = R ∫ sec ⁡ φ d φ + C y=R\int\sec\varphi\,d\varphi+Cy=R∫secφdφ+C

为求出右侧,分子分母同乘sec ⁡ φ + tan ⁡ φ \sec\varphi+\tan\varphisecφ+tanφ:

∫ sec ⁡ φ d φ = ∫ sec ⁡ 2 φ + sec ⁡ φ tan ⁡ φ sec ⁡ φ + tan ⁡ φ d φ \int\sec\varphi\,d\varphi=\int\frac{\sec^2\varphi+\sec\varphi\tan\varphi}{\sec\varphi+\tan\varphi}\,d\varphi∫secφdφ=∫secφ+tanφsec2φ+secφtanφ​dφ

因为( tan ⁡ φ ) ′ = sec ⁡ 2 φ (\tan\varphi)'=\sec^2\varphi(tanφ)′=sec2φ,( sec ⁡ φ ) ′ = sec ⁡ φ tan ⁡ φ (\sec\varphi)'=\sec\varphi\tan\varphi(secφ)′=secφtanφ,令u = sec ⁡ φ + tan ⁡ φ u=\sec\varphi+\tan\varphiu=secφ+tanφ,则d u = ( sec ⁡ 2 φ + sec ⁡ φ tan ⁡ φ ) d φ du=(\sec^2\varphi+\sec\varphi\tan\varphi)d\varphidu=(sec2φ+secφtanφ)dφ,故:

∫ sec ⁡ φ d φ = ∫ d u u = ln ⁡ ∣ u ∣ + C = ln ⁡ ∣ sec ⁡ φ + tan ⁡ φ ∣ + C \int\sec\varphi\,d\varphi=\int\frac{du}{u}=\ln|u|+C=\ln|\sec\varphi+\tan\varphi|+C∫secφdφ=∫udu​=ln∣u∣+C=ln∣secφ+tanφ∣+C

代回并利用赤道边界条件y ( 0 ) = 0 y(0)=0y(0)=0,有ln ⁡ ( sec ⁡ 0 + tan ⁡ 0 ) = ln ⁡ 1 = 0 \ln(\sec0+\tan0)=\ln1=0ln(sec0+tan0)=ln1=0,所以积分常数为C = 0 C=0C=0。

y = R ln ⁡ ( sec ⁡ φ + tan ⁡ φ ) y=R\ln(\sec\varphi+\tan\varphi)y=Rln(secφ+tanφ)

由三角恒等式sec ⁡ φ + tan ⁡ φ = tan ⁡ ( π / 4 + φ / 2 ) \sec\varphi+\tan\varphi=\tan(\pi/4+\varphi/2)secφ+tanφ=tan(π/4+φ/2)得到:

x = R λ y = R ln ⁡ tan ⁡ ( π 4 + φ 2 ) \boxed{\begin{aligned}x&=R\lambda\\y&=R\ln\tan\left(\frac{\pi}{4}+\frac{\varphi}{2}\right)\end{aligned}}xy​=Rλ=Rlntan(4π​+2φ​)​​

需要额外注意一下,墨卡托投影的x,y范围都在( x , y ) ∈ [ − π R , π R ] (x,y) \in [-\pi R,\pi R](x,y)∈[−πR,πR]之中

珊格瓦片

先区分几个概念 ,概念可以参考OGC Two Dimensional Tile Matrix Set and Tile Set Metadata Spec

  1. 算法概念

    1.1 grid (网格)

    ⁠network composed of two or more sets of curves in which the members of each set intersect the members of the other sets in an algorithmic way

    1.2space partitioning (空间划分)

    process of dividing a geometric space (usually a Euclidean space) into two or more
    disjoint subsets (see also partition of a set). Space partitioning divides a space
    into non-overlapping regions. Any point in the space can then be identified to lie in
    exactly one of the regions


    1.3tessellation

    In addition to the definition provided in the Terms and Definition, theTessellationconcept includes the rules for tessellating space into aTileSet. The specific allowed/requiredTessellationapproaches are specified in the logical model. For the purposes of this Abstract Specification,tilingis consider a synonym.

    其决定square,hexagon,triangle等瓦片形状,分割的算法。

  2. GIS概念

    2.1 **cell **

    ⁠minimum geometrical spaces delimited by the grid lines of a regular grid.

    相当于像素的概念,这里翻译成像元,和像素点不同的是,cell认为是有其长和宽,可以理解其负责的呈相范围

    2.2 ** tile**

    geometric shape with known properties that may or may not be the result of a tiling
    (tessellation) process. A tile consists of a single connected “piece” without “holes”
    or “lines” (topological disc).In the context of a 2D tile matrix, a tile is one of the rectangular regions of
    space, which can be uniquely identified by an integer row and column, making up the
    tile matrix. In the context of a geospatial data tile set, a tile contains data for such a
    partition of space as part of an overall set of tiles for that tiled geospatial data.

    瓦片的概念和网格的概念有些像,但是我们需要说明的是 瓦片是一个有自我生命周期的实体,而网格更相当于一个算法上的逻辑概念

    In addition to the definition provided in the Terms and Definition, theTessellationconcept includes the rules for tessellating space into aTileSet. The specific allowed/requiredTessellationapproaches are specified in the logical model. For the purposes of this Abstract Specification,tilingis consider a synonym

    2.3tile matrix

    tiling grid in a given 2D coordinate reference system, associated to a specific scale
    and partitioning space into regular conterminous tiles, each of which being
    assigned a unique identifier

    相同resolution的 tile matrix

    一层tile的几何

    2.4tile matrix set

    tiling scheme consisting of a set of tile matrices defined at different scales
    covering approximately the same area and having a common coordinate reference system.

    根据不同的resolution分类的不同的tile matrix

    2.5 tile index

    A tile index provides an efficient (fast) mechanism for finding any tile or set of tiles in a tiled data store when using a spatial filter, including a point and query operation. Typical spatial indexing are R-Trees and Quad-Trees. The logical model specifies no requirements for how a spatial index is constructed or the technology used. However, the tile extents, tile addresses, and tile references can be used to populate a spatial index, such as an R-Tree.

    网格索引,针对一个层级的tile matrix需要进行索引划分,标记每一个tile

    下面这个是四叉树的网格,但是对于珊格瓦片来说,使用固定的四叉树网格,并且使用Z-Order 排序(或者叫Morton 索引) (使用这个的好处是 空间上相邻的物理存储上也可以做到相邻,减少磁盘IO的成本)

    对于珊格瓦片,TMS瓦片发布的索引是左下角为原点,(0,0),对于WMTS和XYZ瓦片发布则是左上角为原点。下面这个图是以左上为原点的

cv概念
TIFF

printer language or page description language. The purpose of TIFF is to describe and store raster image data.

A primary goal of TIFF is to provide a rich environment within which applica- tions can exchange image data. This richness is required to take advantage of the varying capabilities of scanners and other imaging devices.

Though TIFF is a rich format, it can easily be used for simple scanners and appli- cations as well because the number of required fields is small.

TIFF will be enhanced on a continuing basis as new imaging needs arise. A high priority has been given to structuring TIFF so that future enhancements can be added without causing unnecessary hardship to developers.

我们重点需要关注的是geotiff 他是tif的增强版本,额外增加了一些字段用于记录空间信息的

geotiff

This OGC® Standard defines the Geographic Tagged Image File Format (GeoTIFF) by specifying the content and structure of a group of industry-standard tag sets for the management of georeferenced or geocoded raster imagery using Adobe’s publicly-available Tagged Image File Format (TIFF).

GeoTIFF defines a set of TIFF tags provided to describe all “Cartographic” information associated with TIFF imagery that originates from satellite imaging systems, scanned aerial photography, scanned maps, digital elevation models, or as a result of geographic analyses. The goal is to provide a consistent mechanism for referencing a raster image to a known model space or earth-based coordinate reference system and for describing those coordinate reference systems.

The tags documented in this standard are to be considered completely orthogonal (i.e., independent) to the raster-data descriptions of the TIFF specification, and impose no restrictions on how the standard TIFF tags are to be interpreted, which color spaces or compression types are to be used, and so forth.

This OGC Standard is a minor revision of GeoTIFF focused on updating the current GeoTIFF community specification and aligning it with current OGC standardization practice. This includes enabling the use of coordinate reference systems that have been included in EPSG register since the GeoTIFF 1.0 specification dating from 1995. As such, the OGC GeoTIFF Standard should be backward compatible with the 1.0 version, both for coordinate reference systems based on EPSG register codes, or user-defined coordinate reference systems. Backward compatibility documents this backward compatibility and the evolutions of the 1.1 revision

为了给图像添加空间参考信息,一个简单的想法就是利用 TIFF 的 tags 来存储空间参考。

但在实际实现中,为了节省 TIFF 预留的标签资源,GeoTIFF 使用了 GeoKeys 来组织众多空间参数,所有 GeoKeys 由 GeoKeyDirectoryTag 来索引。

颜色磁盘存储方式

分为三种存储方式,分别是

  1. Band Sequential 按照波段进行存储,一个波段的数据存储完存储下一个
  2. Band Interleaved by Line 按行交错,是BSQ和BIP的妥协版本,按照行进行像素的交错存储,一行内按照像素交错存储
  3. Band Interleaved by Pixel 按照像素进行交错

像素的数据结构

Each image pixel in a data file has a numeric value, and for any image the pixel values will fall within a certain range, for example integers from 0 to 255. Some images have pixel with real (floating point) number values or that span a larger range of values. Assigning adata typeto an image constrains the pixel values allowed. A “byte image” is a common term used to denote that an image has pixels values that fit within a single byte of computer storage, that is, integer values from 0 to 255. Data types are more complicated when the numeric values are outside this range or when floating point values are required. Each pixel value might require 2 or 4 or even 8 bytes, and the order of the bytes is important, at least to the computer. This is why you need specialized software to work with some archive images: web browsers and general software are not good at working with images that have complex data types. It is possible to convert an image from a complex data type to a simple one that web browsers can understand (the browse version mentioned above), but you lose the science data fidelity.

参考资料

https://docs.ogc.org/is/17-083r4/17-083r4.html#toc54

https://docs.ogc.org/as/19-014r3/19-014r3.html

https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf

https://docs.ogc.org/is/19-008r4/19-008r4.html

https://blog.geohey.com/geotiff-shu-ju-ge-shi-tan-suo/

https://an.rsl.wustl.edu/help/Content/Using the Notebook/Concepts and deep dive/Image primer.htm?utm_source=chatgpt.com

返回列表