NOTICE: is being shutdown on 1st March 2024. Please use the OpenStreetMap Community Forum


The building I am asking about has a shape of two plus signs merged side by side. After I added its name I expected it would appear roughly in the middle but instead, the name is shifted to the left, like it was over one of the 'plus signs'. What is the reason for that? Am I missing something important?

Thanks, Michal

asked 22 Dec '18, 18:53

michau's gravatar image

accept rate: 0%

This is how the Mapnik works with "interior" algorithm. It tries to find the point which is the most distant from all the borders and then adds a bit of gravity towards geometric center. I was involved in the process of changing this algorithm, because the old one had some flaws, which resulted in showing labels outside the area, which was a problem that was bugging me, because for example Lake Victoria was rendered somewhere on the ground.

Finding centroid is not trivial task and it depends on the shape heavily. What works better on some of them, is just strange in some other cases. I have reviewed about 100 of different shapes when giving a feedback to the developer, and there was no clear winner and this algorithm was just sane enough.

permanent link

answered 22 Dec '18, 23:57

kocio's gravatar image

accept rate: 20%

While I don't know how the renderer works, my guess is that it is searching for the biggest square area to place the label in. And this happens to be at the center of the western cross.

alt text

permanent link

answered 22 Dec '18, 20:50

pbb's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Dec '18, 18:53

question was seen: 1,566 times

last updated: 22 Dec '18, 23:57

NOTICE: is being shutdown on 1st March 2024. Please use the OpenStreetMap Community Forum