mapnik / python-mapnik

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

Cannot set face_name on TextSymbolizer #218

Open larsga opened 4 years ago

larsga commented 4 years ago

I tried:

    ts = mapnik.TextSymbolizer()
    ts.face_name = 'Arial.ttf'

but that failed with:

Traceback (most recent call last):
  File "europe-now-map.py", line 5, in <module>
    themap = config.make_europe_all_map()
  File "/Users/larsga/cvs-co/farmhouse/config.py", line 21, in make_europe_all_map
    east = -5, west = 55, south = 50, north = 65
  File "/Users/larsga/cvs-co/fhdb/reports/mapniklib.py", line 60, in make_simple_map
    ts.face_name = 'Arial.ttf'
  File "/usr/local/lib/python2.7/site-packages/mapnik/__init__.py", line 800, in face_name
    self.format.face_name = face_name
AttributeError: 'TextSymbolizer' object has no attribute 'format'
larsga commented 4 years ago

I can't set it with ShieldSymbolizer, either.

Does this mean it's not possible to render text with Python mapnik? I really need this for maps that are to appear in a book, and my deadline is approaching. Some tips would be much appreciated.