python-mapnik icon indicating copy to clipboard operation
python-mapnik copied to clipboard

3.0.x branch cannot render to Cairo (Python argument types did not match C++ signature)

Open kevinstadler opened this issue 8 years ago • 1 comments

I just compiled mapnik 3.0.13-rc1, followed by the 3.0.x branch of mapnik-python. Using either

surface = mapnik.printing.PDFPrinter()
surface.render_map(m, "output.pdf")

or the direct

surface = cairo.PDFSurface("output.pdf", m.width, m.height)
render(m, surface)
surface.finish()

I get

  File "/usr/lib64/python2.7/site-packages/mapnik-0.1-py2.7-linux-x86_64.egg/mapnik/printing/__init__.py", line 153, in render_map
    self._render_layers_maps(m, ctx, tx, ty)
  File "/usr/lib64/python2.7/site-packages/mapnik-0.1-py2.7-linux-x86_64.egg/mapnik/printing/__init__.py", line 290, in _render_layers_maps
    self._render_layer_map(layer_map, ctx, tx, ty)
  File "/usr/lib64/python2.7/site-packages/mapnik-0.1-py2.7-linux-x86_64.egg/mapnik/printing/__init__.py", line 337, in _render_layer_map
    render(layer_map, ctx)
Boost.Python.ArgumentError: Python argument types in
    mapnik._mapnik.render(Map, cairo.Context)
did not match C++ signature:
    render(mapnik::Map, mapnik::image_any {lvalue})
    render(mapnik::Map, mapnik::image_any {lvalue}, double)
    render(mapnik::Map, mapnik::image_any {lvalue}, double, unsigned int)
    render(mapnik::Map, mapnik::image_any {lvalue}, double, unsigned int, unsigned int)

(except in the latter case the second argument type is of course cairo.PDFSurface)

Is this just me trying the wrong rendering functions or is there a problem with the generated bindings?

kevinstadler avatar Feb 02 '17 21:02 kevinstadler

have you set environment variable PYCAIRO before building mapnik-python ?

niconil avatar Aug 14 '17 08:08 niconil