ThinkGeo.com    |     Documentation    |     Premium Support

Exporting bitmap from WPF control without showing control

Hello,

there have been already some questions about exporting bitmaps, but they don’t match my case. I’d need to export a bitmap

  • of the whole map (not just one layer / overlay)
  • in WPF edition
  • from a control that is not shown on screen

A call to WpfMap.GetBitmap is not working when the control is not shown on screen.
Can you give an example how to accomplish this. Is this possible at all or do one have to use Service Edition?

Regards,
Markus Meyer

Hi Markus Meyer,

There are 2 options to do that:

  1. Use the GeoCanvas to draw the layers.
  2. Use MapEngine to draw the layers into a bitmap.

Attached shows how to export the map by using GeoCanvas.

ExportBitmap.zip (1.5 MB)

Hope it’s helpful.

Thanks,
Peter

Hi Peter,

thank you for your answer. That works well for Shapefile-Layers, but what to do with Overlays like

  • OpenStreetMapOverlay / BingMapsOverlay
  • MarkerOverlay?

Regards,
Markus

Hi Markus,

For OpenStreetMapOverlay / BingMapsOverlay, we can use the corresponding layers to instead, like OpenStreetMapLayer / BingMapsLayer, but there is no layer for the MarkerOverlay. In WPF Edition, the marker is a ContentControl, so I guess you need to render the map before export it to the bitmap.

Thanks,
Peter