Skip to content

FormattingText is not defined #89

Open

Description

@Jenselme

I am trying to use the python bindings to style text. To do that, I define a TextSymbolizer and I try to set its name property. However, when I do this, I get this expection:

Traceback (most recent call last):
  File "bug.py", line 4, in <module>
    text_symbolizer.name = mapnik.Expression('[name]')
  File "/usr/lib64/python3.4/site-packages/mapnik/__init__.py", line 824, in name
    self.properties.format_tree = FormattingText(name)
NameError: name 'FormattingText' is not defined

From what I see in mapnik_text_placement.cpp the code that provides this functionality is commented. If I try to uncomment the code, python-mapnik doesn't compile.

Can you fix this ?

To reproduce, use the code below:

import mapnik

text_symbolizer = mapnik.TextSymbolizer()
text_symbolizer.name = mapnik.Expression('[name]')

Activity

  1. Ghoughpteighbteau commented on Sep 6, 2016

    @Ghoughpteighbteau

    It seems like TextSymbolizer has become deprecated? We've been doing some forensics trying to figure out what's going on.

    The last thing to touch the commented out code referenced this issue in mapnik mapnik/mapnik#2324

    Which leads to here: #7

    which says something about the symbolizers being represented differently in python somehow... and that we should be using the "XML styling interface"

    We're still looking into what exactly the "XML styling interface" is. 😠

    edit: oh wait. oh wait oh wait oh wait.

    It's reading the XML file. instead of creating objects you just read in an XML file, if you want to do it dynamically you write to an XML file then read it via mapnik. OK. I think I see.

  2. Jenselme commented on Sep 7, 2016

    @Jenselme
    Author

    It's reading the XML file. instead of creating objects you just read in an XML file, if you want to do it dynamically you write to an XML file then read it via mapnik.

    That's how I made text symbolizers work. Took me a while to figure out though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions