问题
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.
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 :)
Below are the libraries I'm using: - React - Threebox - MapboxGL
Thanks
回答1:
Try https://github.com/mapbox/tilebelt. Specifically tilebelt.tileToBBOX will give you the lng/lat bounds of an z/y/x tile.
来源:https://stackoverflow.com/questions/50245182/mapbox-get-loaded-tile-coordinates