export-bitmap Command


Exports the current map to a bitmap file.


   [file=<output file>] 
   [width=<bitmap width>] 
   [height=<bitmap height>] 
   [map-scale=<map scale>]
   [subpixel=<subpixel precision>]
   [color-depth=<8 or 32>]

All parameters are optional:

The command records a list of generated files. This list can be automatically forwarded to subsequent file commands like ftp-upload Command and zip Command.

Supported Bitmap Types

export-bitmap Command can export the map to the following bitmap types:

You can specify the bitmap type by specifying the file extension of the output file name:

export-bitmap file=output.tiff

Setting The Zoom Level Or The Map Scale

If you specify the zoom or map-scale parameters, Maperitive will adjust the bitmap size so that map bounds remain the same. Let's say you are viewing a map through a 1000x800 window on a zoom level 10 and you call

export-bitmap zoom=11

Increasing the zoom level by one will actually increase the map size by 100%, so you'll end up with an exported bitmap that's 2000 pixels wide and 1600 pixels tall.

You cannot specify both the zoom and the map scale at the same time.

Setting The Width Or Height

If you specify the width or the height parameter, Maperitive will adjust zoom level so that map bounds remain the same. Again, let's say you are viewing a map through a 1000x800 window on a zoom level 10 and you call

export-bitmap width=500

The resulting exported bitmap will be 500 pixels wide and 400 pixels tall and it will be rendered using the zoom level of 9.


The scale parameter allows you to generate bitmaps with higher resolution, which is more suitable for printing maps (the other option is to use the export-svg Command). The below sample bitmap was generated with the scale value of 8:

Web Maps

export-bitmap Command uses all the map sources currently registered in the map. This includes web maps (like Mapnik or Osmarender), so if you have one of those, be warned that exporting can take a very long time since Maperitive has to download each tile from the web before it can generate an exported bitmap. In order not to overload OSM servers, Maperitive limits how fast web tiles can be downloaded.


"Bitmap Too Big"

There is a limit of how large a bitmap can be produced using the export-bitmap. To quote Bob Powel, an authority on GDI+ (the graphics engine Maperitive uses), "the maximum size of a bitmap is governed by the memory available to the application. Even in the best possible case of an application with very little used resources, the address space is limited so as you fill it up (2 gigs max for a 32 bit process I think) the maximum you can allocate is reduced."

If this limit has been reached, GDI+ reports a system exception which is then handled by the export-bitmap and a more user-friendly message is displayed: "Could not generate the bitmap, it is probably too big".

What can you do about it? Frankly, I'm not sure. It probably depends on how large your bitmap is. Here are some possible options:

  1. Try to restart Maperitive and then export the bitmap as soon as you can.
  2. Reduce the memory fragmentation - try to run Maperitive on a cleanly started machine, without other programs.
  3. More RAM? (don't quote me on this)

More about this problem:

See also: