Skip to content

Mt.Everest Tile not found after converting #43

Description

@mpaccione

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.

https://api.mapbox.com/v4/mapbox.terrain-rgb/9/3209405.2294914094/9654494.533620872.pngraw?access_token=pk.eyJ1IjoibXBhY2Npb25lIiwiYSI6ImNrbjI5bXB1bDE1bDIydm1sZHl3NHRlM3QifQ.22OWoeAEOElNOu0W4ZsdFA

{ 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);
  }
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions