суббота, октября 05, 2024

The Nicknames of America

Some U.S. cities have very quirky nicknames. Apparently, the citizens of Auburn, Alabama like to call their town the 'Armpit of the Confederacy'. While their nearby neighbors in Gordo, Alabama call their home the 'Armpit of Civilization'. 

Elmwood and Belleville in Wisconsin both claim to be the 'UFO Capital of the World' (presumably because of all the strange, alien-looking folk living in both towns). White Center in Washington likes to be affectionately known as 'Rat City' and Chatsworth, California has adopted the moniker 'San Pornando'.

You can find these five city nicknames and the nicknames of around 1,600 other cities on my new interactive US Nicknames Map.

I'll admit that browsing U.S. city nicknames will probably have limited appeal. However, I actually made the map as an example of overcoming a couple of issues I discovered this week when using OpenFreeMap and Versa Tiles with MapLibre.

Both OpenFreeMap and Versa Tiles are fantastic, free map-tiles that can be used with the MapLibre GL mapping library. This week, however, I discovered a couple of issues with using OpenFreeMap and Versa Tiles with expressions and with variable label placement with MapLibre. To be clear, this is not a problem with either OpenFreeMap or Versa Tiles, but the problem arises because the MapLibre documentation uses different map-tiles in their example maps.

In both cases, the problems with the MapLibre example maps are that they attempt to reference fonts which are not present in the OpenFreeMap and Versa Tiles map styles. For example, if I copy the code for the variable label placement map and attempt to swap in the OpenFreeMap Liberty map style as the tile layer, then I get this 404 error:  'https://tiles.openfreemap.org/fonts/Open%20Sans%20Regular,Arial%20Unicode%20MS%20Regular/0-255.pbf 404 (Not Found)'. 

Both OpenFreeMap and Versa Tiles use Noto Sans instead of Arial as the font for the map labels. So when you want to use variable label placement or use expressions to change map labels (as I am doing with my US Nicknames Map) you need to point the map to use the available font. So, for example, for the OpenFreeMap Liberty map style we have to change the demo code to add a map layer to: 

'layout': {
'text-field': ['get', 'description'],
'text-font': ['Noto Sans Regular'], // Specify the font here
'text-variable-anchor': ['top', 'bottom', 'left', 'right'],
'text-radial-offset': 0.5,
'text-justify': 'auto',
'icon-image': ['concat', ['get', 'icon'], '_15']
}

Similarly, if you check out the source code in my US Nicknames Map, you will see that the 'map.addLayer' custom layer also references "text-font": ["Noto Sans Regular"].

2 комментария:

Анонимный комментирует...

Why is Berlin's Nickname The geographic center of connetitucut? and why is DC's nickname the corn cob pipe capital of the world

Keir Clarke комментирует...

The map uses Maplibre expressions. Expressions change an edited string globally. So if I change Paris to 'City of Light'. Then Paris, France and Paris, Texas will both display as 'City of Light'. As will all other locations called Paris in the world.