Automagic labeling! (Say goodbye to manually adding label points, unless you love them!)

I’m very excited to report that the site will now automatically generate label points for administrative boundaries. Automated labeling will be coming soon for other areas (parks, buildings, etc.), but I wanted to share this for now. Special thanks to @Rub21 and @vanessa_GIN for making this happen. :clap:t2: :clap:t2: :clap:t2:

For example, there’s only 1 manually-placed label in this 1885~ map of the Iberian Peninsula:

All of the other labels have been automatically placed. If you’re a boundary relation mapper, this is a HUGE time saving.

The algorithm works by drawing the biggest circle it can inside a shape and then places the label point at the center of that circle.

There are, however, times when this doesn’t work as well as hoped.

For example, La Rioja kind of works, but looks a bit off-kilter in the map above:

As does Castilla-La Mancha:

Luckily, I can just go in and create a node where I think the label should be for each place and add it to the appropriate relation. How to place this node? This is cartographic art, not science (although there can be plenty of science behind label placement) for me.

Creating label points in JOSM: create a node, copy tags from the relation, remove relation- and boundary-specific tags, add the node to the relation with the role of label:


Voilá, improved labeling goodness.

Now, to do something about that Portugal label…

6 Likes

Great feature, definitely makes mapping easier!

What do you think about the idea of ​​adding labels automatically for territories that are completely surrounded by other territories?

Enclaves and exclaves were quite common in the past (like these here or these) and sometimes it’s hard to figure out who owns what just by looking at the map.

I can imagine though that adding all these labels might make the map too crowded…:thinking:

2 Likes

That’s a great question and is something we’re thinking about.

Bottom line is that any area with a name should have a label. To your point about crowding, the question is when to show that label.

Once we get automated label points for non-boundary areas, we’ll probably tackle this next.

One thought is that for items with a certain area (e.g. small places), we would only show labels at higher zooms. The good news is that our pipeline can automatically calculate the areas, width, etc., so this approach would not require any additional tagging maintenance.

But… there might be exceptions for some smaller places where we do want labels, so we’d need to be able to override that automation, like we have for the admin boundary areas.

We’re also busy trying to figure out how to increase the visual contrast between entities of different levels.

As always, please let us know how you’d like to see things work or what makes sense to you!

1 Like

Those are some great reference points for future testing… thank you for finding and posting them! cc: @vanessa_GIN

1 Like

If anyone finds themselves putting in many of these overrides and there seems to be a pattern to them, please report a bug so we can find a more automated approach to correctly labeling that class of geometries. In general, automated label placement is preferable to manual label placement, because an automated label can potentially respond to changes in projection, zoom level, rotation, etc.

That said, the label role is more commonly used to link the point and area representations of a populated place. We don’t expect to ever automate these labels. For example, the Detroit node sits in the city center, which is several miles away from the less meaningful geometric centroid of the Detroit city limits. Please continue to map these nodes.

I think the current algorithm would just label the centroid of the multipolygon’s largest polygon. If we were to label the centroid of each of the multipolygon’s polygons, then it could get confusing in some cases. For example, each of the Hawaiian Islands would get the label “United States”, which would probably crowd out the less important “Hawaii” label. So far, the boundary relations for France only cover Metropolitan France, but one would probably expect a map to indicate the other parts of France somehow.

When it comes to outlying territorial possessions, I suppose the ideal label would be the name of that possession with the possessor in parentheses. This might require some novel tagging ideas, or the renderer might need to consult Wikidata.

1 Like