简体   繁体   English

间距大于0的Mapbox gl原生拼接图块

[英]Mapbox gl native stitching tiles with pitch greater than 0

Mapbox-gl-native allows to render vector tiles server side. Mapbox-gl-native 允许在服务器端渲染矢量图块。 The API renders a tile by passing a center coordinate of the tile. API 通过传递瓦片的中心坐标来渲染瓦片。

It returns a map tile image.它返回 map 平铺图像。 To get a larger image it is required to render multiple tiles and stitch them together.要获得更大的图像,需要渲染多个图块并将它们拼接在一起。 To move from one tile to adjacent one it is pretty simple, you have to multiply the resolution of the zoom level with the tiles geographical information width or height (depending on which direction you want the adjacent tile).要从一个瓦片移动到相邻的瓦片非常简单,您必须将缩放级别的分辨率与瓦片地理信息的宽度或高度相乘(取决于您想要相邻瓦片的方向)。

So If I have a tile rendered with center point [24.5 56.2] and I want the tile next to it to the right I calculate the center for it like so:因此,如果我有一个使用中心点 [24.5 56.2] 渲染的图块,并且我希望它旁边的图块位于右侧,我会像这样计算它的中心:

offset = levelResolution * 256偏移量 = levelResolution * 256

centerPointInWebMercator->x += offset centerPointInWebMercator->x += 偏移量

adjacentTileCenter = toLatLon(centerPointInWebMercator)相邻TileCenter = toLatLon(centerPointInWebMercator)

This indeed works correct.这确实是正确的。 The problem is when the tiles have a pitch value larger than 0. In this case the above algorithm seems to not be correct as the tiles dont align correctly.问题是瓷砖的间距值大于 0。在这种情况下,上述算法似乎不正确,因为瓷砖没有正确对齐。

在此处输入图像描述

Here is example of two tiles that were requested the first problem is that they contain duplicate information and the second is that some duplicate features seem to have different positioning (rotated differently) see the highlighted region这是请求的两个图块的示例,第一个问题是它们包含重复信息,第二个问题是某些重复特征似乎具有不同的位置(旋转方式不同)请参见突出显示的区域

Ok, I found the solution, the problem was that I was rendering tiles with the default size of 512x512 that then were scaled to higher resolutions.好的,我找到了解决方案,问题是我正在渲染默认大小为 512x512 的图块,然后将其缩放到更高分辨率。

But it is possible to increase the maps size by increasing this size to larger values.但是可以通过将此大小增加到更大的值来增加地图大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM