Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get elevation from mapbox terrain webp #9

Open
geobuilding opened this issue Apr 22, 2022 · 1 comment
Open

Can't get elevation from mapbox terrain webp #9

geobuilding opened this issue Apr 22, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@geobuilding
Copy link

https://codesandbox.io/s/terrain-rgb-g4nym?file=/src/index.ts

import { TerrainRGB } from "@watergis/terrain-rgb";

const url = "https://api.mapbox.com/raster/v1/mapbox.mapbox-terrain-dem-v1/{z}/{x}/{y}.webp?sku=10149h63PJzgC&access_token=pk.eyJ1IjoiZGV2LWFhYyIsImEiOiJjbDI5MGl5N3QwZGNlM2NuN3l6bGtxaTd6In0.ornsESAnvKKQedUSw2fKyA";
const trgb = new TerrainRGB(url, 512);
const coordinate = [78.34336242946887, 22.133570853753696];
const zoom = 14;


trgb.getElevation(coordinate, zoom).then((elevation: number | undefined) => {
  const doc = document.getElementById("app");
  if (doc) {
    doc.innerHTML = `
    <h1>Hello terrain-rgb!</h1>
    <div>
      <ul>
        <li>URL: ${url}</li>
        <li>Longitude: ${coordinate[0]}</li>
        <li>Latitude: ${coordinate[1]}</li>
        <li>Zoom level: ${zoom}</li>
        <li>Elevation: ${elevation}</li>
      </ul>
    </div>
    <div>
    Look the repository at <a href= "https://github.com/watergis/terrain-rgb" >watergis/terrain-rgb</a>
    </div>
    `;
  }
});

image

@JinIgarashi
Copy link
Member

@hong4k Thank you for reporting. Getting value from terrain rgb webp in the browser is currently not working. the plugin only support WEBP for nodejs application. But welcome any pull request to fix this issue.

@JinIgarashi JinIgarashi added the bug Something isn't working label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants