mapbox / mapbox/sphericalmercator
Mt.Everest Tile not found after converting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 288
- Forks
- 51
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I am working on a Mapbox Three.js Helicopter Flight Simulator for Mt.Everest.
It would appear I need the terrain-rgb png tiles to create a texture height mesh. Unfortunately I am unable to get a tile from Mapbox's API. Can you determine if the issue is with this repo?
I was assuming I would enter the coordinates in Long, Lat (reversed) to generate X, Y coordinates and then pipe them into the v4/mapbox.terrain-rgb endpoint for raw png downloads.
{ res: { message: 'Not Found' } }
Script
const queryMapbox = async () => {
const merc = new SphericalMercator({
size: 256,
});
const xyFromLatLong = (lat, long, merc) => {
return merc.forward([long, lat]);
};
const zoom = 9;
const long = 86.7278;
const lat = 27.6857;
const xyPos = xyFromLatLong(lat, long, merc);
try {
const response = await fetch(
`https://api.mapbox.com/v4/mapbox.terrain-rgb/${zoom}/${xyPos[0]}/${xyPos[1]}.pngraw?access_token=${process.env.ACCESS_TOKEN}`
);
const res = await response.json();|
console.log({ response });
console.log({ res });
} catch (err) {
console.error(err);
}
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided JavaScript queryMapbox script and inspecting the SphericalMercator forward conversion used to build the terrain-rgb URL. Compare the generated zoom, x, and y values with the Mapbox endpoint response; done means establishing whether the failure is caused by this repository or by the requested API coordinates or endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100