mapnik/mapnik — Issue #990: Retrocompatibility shim for TextSymbolizer and ShieldSymbolizer
Author: ThomasG77
Created: 2011-12-11 01:45:02+00:00
State: open

When you set in Python

mapnik2.TextSymbolizer('FIELD_NAME', 'DejaVu Sans Book', 10, Color('black'))

You get an error like

TextSymbolizer.__init__(TextSymbolizer, str, str, int, Color)
did not match C++ signature:
__init__(_object*, boost::shared_ptr >,
boost::recursive_wrapper >,
boost::recursive_wrapper >,
boost::recursive_wrapper >,
boost::recursive_wrapper >,
boost::recursive_wrapper >,
boost::recursive_wrapper
>, boost::recursive_wrapper
>,
boost::recursive_wrapper
>,
boost::recursive_wrapper
>,
boost::recursive_wrapper
>,
boost::recursive_wrapper
>,
boost::recursive_wrapper
>,
boost::recursive_wrapper
>, boost::recursive_wrapper,
boost::recursive_wrapper,
boost::detail::variant::void_, boost::detail::variant::void_> >,
std::string, unsigned int, mapnik::color)

Thanks to Dane on mailing list, I'm now aware it's due to change from 0.7.x to 2.0

Make a shim to convert the string 'FIELD_NAME' to mapnik2.Expression('[FIELD_NAME]') detecting if type string or an Expression object

and add a message saying

'FIELD_NAME' was automatically transform to mapnik2.Expression('[FIELD_NAME]') for retrocompatibility but deprecated
You'd better use mapnik2.Expression('[FIELD_NAME]') than 'FIELD_NAME' now in Mapnik 2