mapnik / python-mapnik

Python bindings for mapnik
GNU Lesser General Public License v2.1
160 stars 91 forks source link

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

Open kevinstadler opened 7 years ago

kevinstadler commented 7 years ago

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?

niconil commented 7 years ago

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