Skip to content

TextSymbolizer.__init__(TextSymbolizer, Expression, str, int, Color) did not match C++ signature #126

Open

Description

@afrigeri

Hello,

running this:

 from mapnik import *
t = TextSymbolizer(Expression('[label]'), 'DejaVu Sans Book', 10, Color('black'))

I'm not able to get rid of this TextSymbolizer related error.

---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-6-eefc1ba347c5> in <module>()
----> 1 t = TextSymbolizer(Expression('[label]'), 'DejaVu Sans Book', 10, Color('black'))
ArgumentError: Python argument types in
    TextSymbolizer.__init__(TextSymbolizer, Expression, str, int, Color)
did not match C++ signature:
    __init__(_object*)

OS: ubuntu 16.10
mapnik: 3.0.12+ds-1
python-mapnik: 1:0.0~20160830-541fd96-1
boost version: 1.61.0.2

any ideas?

Activity

  1. artemp commented on Jan 5, 2017

    @artemp
    Member

    @afrigeri - recommended way to load a style in 3.x.x mapnik is to use XML.
    Current python bindings are lacking support for all TextSymbolizer properties and options. I'll try to find time to add some basic support back but meanwhile consider using load_map + XML

  2. artemp commented on Jan 5, 2017

    @artemp
    Member

    ref #89 ^

  3. afrigeri commented on Jan 5, 2017

    @afrigeri
    Author

    @artemp I see! load_map + XML works with the TextSymbolizer I needed. Is the recommendation to use XML in mapnik temporary for 3.x.x or at some point we can use both python/c++ and xml? Is there a page where I can check the status of this?

  4. kevinstadler commented on Jan 7, 2017

    @kevinstadler

    I'd be curious about that as well, the 3.0.12 python bindings don't seem to export the Stroke class at all, which makes it impossible to work with most of the other Symbolizers. According to #7 we shouldn't expect a direct style interface any time soon, so using an XML library to dynamically write xml styles and then loading them via load_map seems to be it for now...

  5. talaj commented on Jan 7, 2017

    @talaj
    Member

    Is the recommendation to use XML in mapnik temporary for 3.x.x or at some point we can use both python/c++ and xml?

    You can use the C++ style interface anytime if XML doesn't suit your needs. Only Python interface is problematic as there is no maintainer able to keep pace with the C++ interface.

    I think the recommendation to use XML is mainly because it's very stable across Mapnik versions, it's simple to use and reasonably fast.

  6. mrterry commented on Jul 24, 2017

    @mrterry

    Is there a way to use load_map + XML + mapnik.MemoryDatasource? All the examples I've found have SQL query or shapefile datasources. I would like to specify my data from Python, but use the XML file for everything else.

  7. springmeyer commented on Sep 3, 2017

    @springmeyer
    Member

    Is there a way to use load_map + XML + mapnik.MemoryDatasource?

    No @mrterry, by design. The mapnik.MemoryDatasource API is only a programmatic API and not something that you can create via XML. If you want to create in memory features via XML you could:

    • Easy: Use a geojson datasource and provide a geojson string in the XML and pass it via the inline. This effectively allows in-memory data to be used and is quite fast. This would work via python the same way as it does via node.js. A nodejs example of doing this is at https://github.com/mapbox/geojson-mapnikify.
    • Hard (would require significant C++ coding): pick up this abandoned effort to support the python datasource inside the python bindings: python plugin inside bindings? #6
  8. mrterry commented on Sep 6, 2017

    @mrterry

    @springmeyer Thanks for the unambiguous answer. We ended up taking the easy path.

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