Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Render names on correct side of administrative boundaries #2990

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments
Closed

Render names on correct side of administrative boundaries #2990

openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments

Comments

@openstreetmap-trac
Copy link

Reporter: stanton
[Submitted to the original trac issue database at 9.21pm, Friday, 21st May 2010]

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:

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

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

@openstreetmap-trac
Copy link
Author

Author: Ldp
[Added to the original trac issue at 11.53pm, Thursday, 3rd June 2010]

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.

@openstreetmap-trac
Copy link
Author

Author: stanton
[Added to the original trac issue at 10.00pm, Wednesday, 30th June 2010]

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.

@openstreetmap-trac
Copy link
Author

Author: stanton
[Added to the original trac issue at 1.20am, Saturday, 29th January 2011]

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.

@openstreetmap-trac
Copy link
Author

Author: Ldp
[Added to the original trac issue at 10.01pm, Thursday, 8th March 2012]

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.

@openstreetmap-trac
Copy link
Author

Author: math1985
[Added to the original trac issue at 1.46am, Wednesday, 26th March 2014]

This issue has now been resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant