1
votes

I am new to mapbox and am trying to get the Terrain rgb data. I have followed the example from the documentation here : https://www.mapbox.com/help/access-elevation-data/

and used the following query:

api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token={my_access_token}

which works find for zoom levels from 0 to 5 and returns RGB tiles of elevation data from a high level.

api.mapbox.com/v4/mapbox.terrain-rgb/5/0/0.pngraw?access_token={my_access_token}

I need to get the data at a much higher zoom level than 5, but once I use a zoom level above 5 it returns 'Tile Does Not Exist'.

The documentation says that there is data up to zoom of 15. My access token works and I have tried x,y tiles of 0, 0 (which should exist at all levels). Has anyone any help or suggestions ?

1

1 Answers

0
votes

Had a similar issue and in my case the mistake was assuming that given an {x}/{y} tuple the zoom {z} was free to change, but it isn't, if zoom changes xy changes too.

To get the correct tiles I used mercantile (pip install mercantile)

import mercantile

print(mercantile.tile(-71.0638031, 42.3578952, 15)) 
>>> Tile(x=9915, y=12120, z=15)