I'm using Mapbox vector tiles to gather specific data from a backend process. In the examples, they provide a link of a Manhattan tile:
http://a.tiles.mapbox.com/v3/examples.map-zr0njcqy/14/4823/6160.png
being the tile z/x/y coordinates 14/4823/6160
I know from navigating the map that the position of latitude 40.706119 and longitude -74.017554 is inside that tile.
I also deduct from how map works that working with zoom 14 the entire map is composed from 16384 x 16384 tiles being 14/0/0 the top left tile.
Yet taking the 180 degrees of latitude and 360 of longitude with the total tile cols and rows gives me 14/7464/4486 which is not the same tile. (Unless I didn't do it right?)
The question
How do I get the tile coordinates knowing the latitude and longitude?
Digging in mapbox-studio source code I've found this little helper object:
https://github.com/mapbox/mapbox-studio/blob/5ac2ead1e523b24c8b8ad8655babb66389166e87/ext/sphericalmercator.js
that can be used like this:
14/4823/6160