Skip to content

How to get raw dem data for a tile? #4721

Answered by pcace
pcace asked this question in Q&A
Sep 18, 2024 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

Hi, its probably not the best way to do that, but i now have a worker wich get the png elevation image and makes its own DEM data from it like so:

const createDEMDataFromImageBuffer = async (tileImageBuffer: {
  buffer: ArrayBuffer
  tile: {
    tx: number
    ty: number
    zoom: number
  }
}): Promise<DEMData> => {
  // Konvertieren des ArrayBuffer in ein Blob-Objekt
  const blob = new Blob([tileImageBuffer.buffer], { type: 'image/png' })

  // Erstellen eines ImageBitmap-Objekts aus dem Blob
  const imageBitmap = await createImageBitmap(blob)

  // Erstellen eines Canvas-Elements
  const canvas = new OffscreenCanvas(imageBitmap.width, imageBitmap.height)
  canvas.width = imageBitmap.width

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@HarelM
Comment options

@pcace
Comment options

@HarelM
Comment options

@pcace
Comment options

Answer selected by pcace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants