Skip to content
  1. Examples
  2. Geo Mode
  3. Maps export to PNG

Maps export to PNG new ​

This example shows how to export a graph rendered on a basemap to PNG through the new Geo module, working uniformly across three providers: Mapbox GL, MapLibre GL and deck.gl. Use the top-right panel to switch between providers, and the two buttons to export either the current view (clip: true) or the entire graph (clip: false, which fits the provider to the graph's geographic bounds before exporting). Results are shown in a modal built from the ogma-ui-kit (Shoelace) sl-dialog component, with a download button.

Notes:

  • Mapbox GL and MapLibre GL must be constructed with preserveDrawingBuffer: true so the WebGL canvas remains readable outside of its draw frame.
  • deck.gl should be constructed with parameters: { preserveDrawingBuffer: true } for the same reason — otherwise the exported basemap is blank on some browsers.
  • Enabling Geo registers a background exporter on the Ogma instance, so ogma.export.png composites the basemap automatically — no extra options needed.