Package mapnik :: Module printing

Module printing

Mapnik classes to assist in creating printable maps

basic usage is along the lines of

import mapnik

page = mapnik.printing.PDFPrinter() m = mapnik.Map(100,100) mapnik.load_map(m, "my_xml_map_description", True) m.zoom_all() page.render_map(m,"my_output_file.pdf")

see the documentation of mapnik.printing.PDFPrinter() for options

Classes
  centering
Style of centering to use with the map, the default is constrained
  resolutions
some predefined resolutions in DPI
  PDFPrinter
Main class for creating PDF print outs, basically contruct an instance with appropriate options and then call render_map with your mapnik map
Functions
 
m2pt(x)
convert distance from meters to points
 
pt2m(x)
convert distance from points to meters
 
m2in(x)
convert distance from meters to inches
 
m2px(x, resolution)
convert distance from meters to pixels at the given resolution in DPI/PPI
 
any_scale(scale)
Scale helper function that allows any scale
 
sequence_scale(scale, scale_sequence)
Default scale helper, this rounds scale to a 'sensible' value
 
default_scale(scale)
Default scale helper, this rounds scale to a 'sensible' value
 
deg_min_sec_scale(scale)
 
format_deg_min_sec(value)
 
round_grid_generator(first, last, step)
 
convert_pdf_pages_to_layers(filename, output_name=None, layer_names=(), reverse_all_but_last=True)
opens the given multipage PDF and converts each page to be a layer in a single page PDF layer_names should be a sequence of the user visible names of the layers, if not given or if shorter than num pages generic names will be given to the unnamed layers
Variables
  HAS_PYCAIRO_MODULE = False
  HAS_PANGOCAIRO_MODULE = False
  HAS_PYPDF = False
  pagesizes = {'a0': (0.841, 1.189), 'a0l': (1.189, 0.841), 'a1'...
size of a pt in meters
  pt_size = 0.000352777777778
  __package__ = 'mapnik'
Function Details

convert_pdf_pages_to_layers(filename, output_name=None, layer_names=(), reverse_all_but_last=True)

 

opens the given multipage PDF and converts each page to be a layer in a single page PDF layer_names should be a sequence of the user visible names of the layers, if not given or if shorter than num pages generic names will be given to the unnamed layers

if output_name is not provided a temporary file will be used for the conversion which will then be copied back over the source file.

requires pyPdf >= 1.13 to be available


Variables Details

pagesizes

size of a pt in meters

Value:
{'a0': (0.841, 1.189),
 'a0l': (1.189, 0.841),
 'a1': (0.594, 0.841),
 'a10': (0.026, 0.037),
 'a10l': (0.037, 0.026),
 'a1l': (0.841, 0.594),
 'a2': (0.42, 0.594),
 'a2l': (0.594, 0.42),
...