Mapbox:获取已加载的图块坐标? [英] Mapbox: Get loaded tile coordinates?
问题描述
I'd like to load 3D terrain onto my mapbox map, like Peter's example, however I'm hoping to find a much simpler implementation. My idea is to use mapbox's data event to get each loaded tile and simply load a three.js mesh above it.. but I need to figure out how to calculate each tile's lng/lat in order for this to work.
data事件的确会返回一个包含大量信息的tile对象(每个已加载的tile),但是,我对地理空间数据是完全陌生的,不胜感激有关如何获取坐标的任何提示.我的猜测是使用tile的posMatrix属性(一个float32数组)进行转换,但我实际上只是在这里抓住稻草:)
The data event does return a tile object (for each loaded tile) with lots of information, however, I am completely new to geospatial data and would appreciate any hints on how to get the coordinates. My guess is to use the tiles posMatrix property (a float32 array) to convert it but I'm really just grasping at straws here :)
以下是我正在使用的库: -反应 - Threebox - MapboxGL
Below are the libraries I'm using: - React - Threebox - MapboxGL
谢谢
推荐答案
尝试 https://github.com/mapbox/tilebelt .具体来说,tilebelt.tileToBBOX将为您提供z/y/x磁贴的lng/lat边界.
Try https://github.com/mapbox/tilebelt. Specifically tilebelt.tileToBBOX will give you the lng/lat bounds of an z/y/x tile.
这篇关于Mapbox:获取已加载的图块坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!