Monday, January 28, 2019

Naming Forests

Some time ago I wrote a number of posts on naming map features.  At the time I didn't get around to naming forests, so I'm going to do that now.  Having named a number of features at this point, I know there are three main questions to answer:  (1) When should I name a feature?  (2) How do I generate a name for this sort of feature?  and (3) How should I display this name on the map?

Some map features always get named -- for example, towns and cities are always named and labeled on the map.  Other features only get named sometimes.  For example, Dragons Abound doesn't give a name to every point or bay on the map.  The rationale for when to name varies based upon the feature.  Sometimes a feature doesn't get named because it's not significant enough to warrant a name -- an example of this being small bays or points.  Sometimes a feature doesn't get named because (I think) it will make the map less interesting.  For example, I'll only label three bays or points in a typical sized map.  Even if there are more suitable candidates, it starts to detract from the interest of the map if they're all labeled.  And finally, sometimes a feature doesn't get labeled because the label won't fit on the map or creates clutter.  In Dragons Abound, this happens fairly often with rivers -- although every river gets a name, only the labels that will fit on the river will actually get displayed.

For forests, the main criteria for naming is the size of the forest.  In most cases, small forests aren't interesting enough to warrant a label.  (On the other hand, one of the key elements of creativity is breaking these sorts of rules; you can imagine a map with one small, isolated forest with a name like “The Druid's Woods" -- that would be quite interesting.)  Another problem with labeling small features is that the label will often not fit within or close to the feature, creating map clutter.  A secondary criteria is the number of named forests on the map.  As with bays and points, it's better to only label a couple of forests to help them feel “special."

Another challenge for forests is deciding what exactly counts as a forest to be labeled.  Here's a map excerpt with the forests outlined in purple:
As this illustrates, forests are often chopped up into pieces (or turned into awkward shapes) by rivers.  That's really just an artifact of illustrating the map.  The rivers actually run through the forest.  The forest is just pulled back from the rivers to make them easier to see.  That's apparent if I use a style that doesn't pull back from the rivers:
For labeling purposes, I probably want to ignore rivers when defining the forest areas.  So the above map would have one big forest rather than seven smaller ones.  But that might be a matter of taste.

Dragons Abound also avoids mountains when drawing forests, and this can also split a forest into pieces.  Unlike rivers, mountains can take up a lot of space on the map:
It seems odd to have one forest stretch over such a big chunk of map with no connection between the parts.  So unlike rivers, I'll allow mountains to separate one forest into two:
With the first question settled, let me jump ahead to the third question -- how I will display the name on the map.  I have a couple of immediate options that reuse existing code.  The first is to treat the name as an area label, similar to what I do for country names or ocean names -- the label floats around inside the area, looking for a good fit.  The second option is to tie the label to an (imaginary) point at the center of the area and let the label try to find a good fit near that point.

Here's an example of the area label option, using a multi-line label:
Right now I just want something that works so I can see the invented names.  I will tweak label criteria and styles to get a better fit later.

I have described previously a number of resources I use to collect possible names for features.  I have some tools that can data mine these resources for words and synonyms in various forms.  It turns out that forest names -- at least in the real world -- are pretty boring.  When I investigate forests, I find that almost all forests in the real world are called “forest" or “woods."  Browsing the historical thesaurus turns up a few other synonyms, but in English “forest" is used far more than any other term.

Looking at the adjectives and other nouns that are used in forest names also turns up nothing too surprising.  Adjectives are dominated by colors and descriptives (like “rough"), and no nouns are used very frequently, although wood types (e.g., “ash") do appear in the list as you might expect.  I'll create a vocabulary starting with the kinds of words I use for naming points and bays, removing all the water-related words, and adding in wood types and wood adjectives.
There will be some editing of the vocabulary and forms of names as I see results that I don't like (or do like).

Now let me return to label placement on the map.  One common style of forest label is to have a slightly arced label, as in this example:
I can reproduce this fairly easily; area labels already have the ability to change their angle and set a curve:
The real challenge is to place angled labels well.  The multi-line horizontal labels work well (almost) anywhere within the label area.  But we expect angled labels to be at an angle for some good reason, usually to fit along the long axis of the label area, or to mirror an important feature of the area.  In the Dragons Abound map above, “Presbyry Farest" (*) looks okay, but “Chi's Woods" doesn't because it is angled perpendicular to the long axis of the forest.  A human labeler would have run “Chi's Woods" along the long axis of those woods.

(* The “Farest" problem happens because of linguistic drift.  There's a list of words that are protected from drift, but I hadn't yet added the forest synonyms to the list when I created that example.)

Zooming out a bit on the example map above (Silverdale by Thomas Rey) shows three or four labels of this sort:
Here you can see that “Hartwood Forest," “Moon Woods," and “Northstar Glacier" all run along the long axis of their areas.  (Hartwood Forest should probably be more vertical, but the Painted Stones icon prevented that placement.)  “Cold Woods" follows an axis as well, but is also placed to run across the top of the river tributaries.  The curves of these labels generally follow the area shapes, except for “Moon Woods," which has the opposite curve.  That looks a little awkward upon reflection; the curve makes the label crowd the edge of the area and be visually a little cluttered with the river label.  Perhaps Thomas did it this way because the opposite curve on a label at that direction would be a little difficult to read.

Good label placement for these sorts of curved and angled labels is very difficult.  First, the size and shape of the label area is not just a geometrical measurement but depends on the map context.  In the Silverdale map, the “Moon Woods" placement is problematic partially because the river label is close to one side of the woods area.  Second, figuring out the axes or straight skeleton of an irregular polygon and applying them to label placement is not trivial.  I suspect that duplicating a good cartographer's label placement in this case would involve many heuristics and special cases.

As what I hope will be an acceptable shortcut for all of that, I've added a placement criteria that tries to maximize the closest distance between the label and the polygon defining the label area.  Although this isn't foolproof, in many cases it will effectively force the label to lie along the major axis of the region.  Here's an example that shows how this heuristic changes the placement of “Chi's Woods:"
In this case, it does a pretty good job of reasonable placement.

However, there are other criteria for label placement, such as not clashing with other labels, so in many cases the eventual placement will not follow only this criteria.  In the image above “Presbyry Farest" is a particular hard placement.  The forest area has numerous other labels which must be avoided, and is criss-crossed with rivers which also must be avoided.  In the end, there's no placement that doesn't break some of these criteria.  “Chi's Woods," on the other hand, can be placed easily into a spot that is far away from the edges of the area at only the cost of obscuring part of a river.

Another style often applied to these sorts of labels is to stretch them out so that they better span the labeled area.  Dragons Abound already does this for ocean labels, so I can easily add this style to forest labels as well:
It might be worthwhile to check the size of the forest area versus the length of the label to determine whether (or how much) extra letter spacing to apply.  Here's an example where a forest name (“Bishop Tanpik's Forest") has been compressed to make it fit better while another name with more room (“Forest of Horses") remains stretched out:
This is less than perfect; it relies on noticing ahead of time that there might be a problem and preemptively shrinking the label.  And it only works in cases where labels have added letter spacing.  A more robust algorithm might notice in the middle of label placement that a label has consistently been hard to place and then look for ways to make the label smaller.  Something to think about for the future.

Here's the full map with labeled features.  With all the heuristics turned on, label placement finds a spot to squeeze in “Bishop Tanpick's Forest" where it barely remains inside the forest and only obscures part of one river:

4 comments:

  1. Your map generation is getting truly amazing now.

    ReplyDelete
  2. I like to think that, after many years as a hermit in the forest, Bishop Tanpik went on a gruelling trek along the mountains and finally found enlightenment at the Heavenly Gulf. Later, admirers and disciples set up a mountaintop abbey halfway along his route, where the crystal waters spring from the rocks and flow back to the forest, to commemorate his journey.

    ReplyDelete
  3. Indeed the Bishop was a holy man. :-)

    ReplyDelete