Opened 9 years ago

Closed 5 years ago

#2990 closed defect (fixed)

Render names on correct side of administrative boundaries

Reported by: stanton Owned by: math1985
Priority: major Milestone:
Component: mapnik Version:
Keywords: Cc:


Currently both names on administrative boundaries are rendered just in the middle of the path. For example:

====== Latvia ====== Lithuania ======

The more correct way would be to render it like:


i.e. with each name on the appropriate side of the border.

Change History (6)

comment:1 Changed 9 years ago by Ldp

It's doable to offset the names, but it's not feasible at the moment to keep the names of the involved administrative areas synched on either side of the boundary. Your example would have Latvia and Lithuania on the correct side of the boundary, but they would each appear at different spots along that boundary.

comment:2 Changed 9 years ago by stanton

well, just offsetting the names is definitely better than what we have now. With names just offset but not synchronized, I know at least which side of the border the place in question is on, and if I want to know what's on the other side, I will just have to pan around a little... so I'd say for now just offset the names.

comment:3 Changed 8 years ago by stanton

Having dealt with Mapnik stylesheets myself in the meantime: can you tell me how you would offset the names and make sure they render on the correct side of the border? That is the only thing I haven't figured out yet.

I know about the dy parameter for TextSymbolizer? to shift text up or down, but as I understand it, that would work either on the northern or on the southern border, but not on both (in one of the two cases, the name would end up in the wrong country).

In fact, keeping the two labels in sync seems to be the easier of the two tasks:

  • Modify the data source to return both labels in a single field, separated by a special character (semicolon comes to mind)
  • In the style's TextSymbolizer?, set justify_alignment="middle" line_spacing="width_of_line_symbolizer" wrap_character=";"

This would essentially create a single label of two lines, with enough space for the border line to fit in between. Again, the remaining problem would be to ensure correct alignment.

comment:4 Changed 7 years ago by Ldp

The renderer is currently still a bit quirky in this respect. The label could wind up on either side of the line, even with the exact same dy value. If mapnik sees that more than 50% of the characters in a label are upside down, it switches that around, but dy is then switched as well.

Needs to be fixed upstream.

comment:5 Changed 5 years ago by math1985

Owner: changed from mapnik-team@… to math1985
Status: newaccepted

This issue has now been resolved.

comment:6 Changed 5 years ago by math1985

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.