#17643·openlayers

New example: screen capture control

Author: Egge-JanCreated Sep 23, 2026Updated Sep 24, 2026

I would like to contribute an example with a custom control that captures the current map as a PNG image. Clicking a camera button renders the map into a canvas (like the export-map example), draws the layer attributions onto it, and shows a half-size preview on top of the map with Download picture and Return to map buttons, allowing the user to preview and optionally amend the picture, before actually downloading it. The download gets a time stamped file name.

Compared to the existing export-map example, this one shows how to build a reusable Control subclass with an in-map preview, without external libraries. (And, as a little extra, this example shows how to use inline SVG to create a picture for a button.)

It would be great if this issue could get a label accepting the pull request :-)

The code is ready on my fork: https://github.com/Egge-Jan/openlayers/tree/example-screen-capture