When you draw a line with a smooth value, and you want to label along the line, you need to smooth the underlying line by the same amount. But there's no smooth parameter for TextSymbolizer.
<?xml version="1.0" encoding="utf-8"?>
<Map background-color="white" srs="+proj=latlong +datum=WGS84">
<Layer name="layer" srs="+proj=latlong +datum=WGS84">
"LINESTRING(0 0, 10 2, 10 5, 0 10)"</Parameter>
<Style name="My Style">
<LineSymbolizer stroke-width="2" smooth="0.8" />
<LineSymbolizer stroke-width="0.2" stroke="#ff0000" />
<TextSymbolizer face-name="DejaVu Sans Book" size="10" placement="line" spacing="20">'Bananas'</TextSymbolizer>
The desired outcome is to label the smooth black line, but the labels just follow the original geometery (in red)
I've updated this with a csv-plugin based testcase.
Yes, text symbolizer does not support smoothing/simplification/offsets, etc. The design of the text symbolizer_helpers (which handle text options) does not currently play nicely with the design of the vertex converters (generic framework for chaining transformations like affine, geo->screen, projection, and things like smoothing). So the task is to refactor the internal design so these code structures can work together. I think @herm has made some progress on this in the harfbuzz branch (where offsets work).
Implementing the other vertex converters should be trivial in the harfbuzz branch. The main problem is that vertex_converters.hpp is extremely complicated code which uses lots of template wizardry. It really needs some documentation.
Having looked at it again here is a completely new proposal for vertex_converters:
virtual void rewind()=0;
virtual bool vertex(double &x, double &y)=0;
class vertex_converter : public vertex_source
virtual void set_input(vertex_source_ptr)=0;
class offset_converter : public vertex_converter
virtual void set_input(vertex_source_ptr);
virtual void rewind();
virtual bool vertex(double &x, double &y);
/* Create list of all active converters for this symbolizer. */
/* Process list. */
vertex_source_ptr vs = GEOMETRY_FROM_DATABASE;
BOOST_FOREACH(vertex_source_ptr converter, converters)
vs = converter;
The code is easy to understand/extend.
@artemp - can you comment on @herm's proposal above? I also wonder about ways to make vertex converters easier to work with. My understanding is that the template approach ensures near zero-overhead whereas the proposal above might incur more runtime overhead, but likely not noticeable.
added vertex_converters in 9835057
fix simply option + tests for #1484 and #1992
This is now implemented in master/upcoming Mapnik 3.x, tests added in d6c59d9, closing.