You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a location-based game and have been having a closer look at the Mapbox SDK (I am building an own light-weight version of a simple slippy map tile provider for Unity taking major inspiration from this SDK). I was wondering if there is a little (conceptual, not sure it has an impact) error in the calculation of the Slippy Tile bounds here:
The formula taken from here: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C# calculated the North West corner coord. So the North-West (top left) coord would be using the tile X and Y. The South-East (bottom right) coord would however use X+1 and Y+1 seeing the tile naming convention starts at the Top-Left of the world (https://wiki.openstreetmap.org/wiki/File:Tiled_web_map_numbering.png). This means, the higher X is the more East we are and the higher Y is, the more South we are. This would mean, the adding for the tiles should be swapped:
public static Vector2dBounds TileIdToBounds(int x, int y, int zoom)
{
var sw = new Vector2d(TileYToNWLatitude(y+1, zoom), TileXToNWLongitude(x, zoom));
var ne = new Vector2d(TileYToNWLatitude(y, zoom), TileXToNWLongitude(x+1, zoom));
return new Vector2dBounds(sw, ne);
}
Or did I miss something?
Ps. This is a great SDK for Unity, thanks for the amazing work!
The text was updated successfully, but these errors were encountered:
I am building a location-based game and have been having a closer look at the Mapbox SDK (I am building an own light-weight version of a simple slippy map tile provider for Unity taking major inspiration from this SDK). I was wondering if there is a little (conceptual, not sure it has an impact) error in the calculation of the Slippy Tile bounds here:
https://github.com/mapbox/mapbox-unity-sdk/blob/78fdee9c7a06c94a6ef493d78d6cf696e44fd4eb/sdkproject/Assets/Mapbox/Unity/Utilities/Conversions.cs#L300C1-L305C4
The formula taken from here: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C# calculated the North West corner coord. So the North-West (top left) coord would be using the tile X and Y. The South-East (bottom right) coord would however use X+1 and Y+1 seeing the tile naming convention starts at the Top-Left of the world (https://wiki.openstreetmap.org/wiki/File:Tiled_web_map_numbering.png). This means, the higher X is the more East we are and the higher Y is, the more South we are. This would mean, the adding for the tiles should be swapped:
Or did I miss something?
Ps. This is a great SDK for Unity, thanks for the amazing work!
The text was updated successfully, but these errors were encountered: