1. pip install mercantile
2. import mercantile in the Mapbox scripts. Remember to append the path first.
3. find this line `terrain_url = "https://api.mapbox.com/v4/mapbox.terrain-rgb/ [api.mapbox.com]" + str(lon) +"," + str(lat) + "," + str((zoom+1)) + "/1024x1024@2x.png?access_token=" + API_KEY `
4. and replaced it with
x, y, z = mercantile.tile(lon, lat, zoom) terrain_url = f"https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y},512@2x.pngraw?access_token={API_KEY}"
Now it should be working.
@MaiAo Any ideas of using 1024 or higher resolution for heightmap?