Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

96
Vistas
Regarding how to render openlayers on offscreencanvas

Recently I came across a post that talks about rendering openlayer layers on the offscreencanvas in a web worker (https://openlayers.org/en/latest/examples/offscreen-canvas.html). I would like to adopt this into my project. My plan is first to figure out how the offscreencanvas rendering works and then add the web worker. Right now I am stuck at the first step (rendering layers on offscreencanvas). I tried to follow the pattern in the post but I could not get the layers rendered on the offscreencanvas.

Here's my understanding of the approach used in the post:

  1. In the main thread, create a "dummy" layer and add it to the openlayer map. The "render" hook on the "dummy" layer will be executed. It then passes the framestate to the web worker.
  2. After receiving the framestate, web worker creates the real layers and renders layers on the offscreencanvas defined in the web worker. Then what is rendered on the offscreencanvas is transferred to a bitmap image. This bitmap image is passed back to the main thread.
  3. After receiving the bitmap image, main thread attaches it to the canvas.

I am playing around the offscreencanvas approach on a codesandbox sample.

Here's the codesandbox that contains the correct shapes rendered on canvas: https://codesandbox.io/s/confident-elion-6qzj9?file=/src/index.js

Here's the codesandbox that contains the offscreencanvas approach but the layers are not rendered: https://codesandbox.io/s/mystifying-glitter-4nqn7?file=/src/index.js

I wonder if anyone has experience rendering openlayer layers on offscreencanvas? Any help is greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda